ARM: USB: Add support for USB HCD on PXA168
Subsystems (8)
cover ARM: USB: Add support for USB HCD on PXA168
This patch series adds support for on-chip EHCI USB host controller on PXA168. The patches depends on patch series that adds support for gplugD
[1] & a couple of fixes[2,3] followed by the same. All of these[1, 2, 3] are accepted by Eric Miao <[email protected]>.
Patches in this series are based on Linux 2.6.39-rc4
[1] http://lists.arm.linux.org.uk/lurker/message/20110502.055957.4236c42a.en.html
[2] http://lists.arm.linux.org.uk/lurker/message/20110714.093715.f1b7c910.en.html
[3] http://lists.arm.linux.org.uk/lurker/message/20110714.093716.615ae7dd.en.html
PATCH 1/3 ARM: pxa168: Remove MTD specific headers
mtd.h defines 'DEBUG' which unintentionally changes behavior of other files that includes pxa3xx_nand.h OR pxa168.h. Anyway, neither mtd/mtd.h nor mtd/partitions.h is needed here
--- arch/arm/plat-pxa/include/plat/pxa3xx_nand.h | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
arch/arm/plat-pxa/include/plat/pxa3xx_nand.h +0 -3
@@ -1,9 +1,6 @@ #ifndef __ASM_ARCH_PXA3XX_NAND_H #define __ASM_ARCH_PXA3XX_NAND_H -#include <linux/mtd/mtd.h> -#include <linux/mtd/partitions.h> - struct pxa3xx_nand_timing { unsigned int tCH; /* Enable signal hold time */ unsigned int tCS; /* Enable signal setup time */
Signature · 1 line
1.7.0.4
PATCH 1/3 ARM: pxa168: Remove MTD specific headers
Quoted 1 line · Tanmay Upadhyay
mtd.hdefines 'DEBUG' which unintentionally changes behavior
I guess the right solution is to fix mtd.h instead of pxa3xx_nand.h
Quoted 2 lines
of other files that includes
pxa3xx_nand.hORpxa168.h. Anyway, neithermtd/mtd.hnormtd/partitions.his needed here
There is a reference of 'struct mtd_partition' below. Though it's possible to remove mtd header references, and declare 'struct mtd_partition' as opaque, the mtd header files are still needed when defining partition layout in board file.
Quoted 24 lines
Signed-off-by Tanmay Upadhyay <[email protected]>---
?arch/arm/plat-pxa/include/plat/pxa3xx_nand.h | ? ?3 --- ?1 files changed, 0 insertions(+), 3 deletions(-)arch/arm/plat-pxa/include/plat/pxa3xx_nand.h +0
-0@@ -1,9 +1,6 @@?#ifndef
__ASM_ARCH_PXA3XX_NAND_H
?#define__ASM_ARCH_PXA3XX_NAND_Harch/arm/plat-pxa/include/plat/pxa3xx_nand.h +0
-3-#include <linux/mtd/mtd.h> -#include <linux/mtd/partitions.h> -?struct
pxa3xx_nand_timing{
? ? ? ?unsigned int ? ?tCH; ?/* Enable signal hold time */ ? ? ? ?unsigned int ? ?tCS; ?/* Enable signal setup time */ --
1.7.0.4
mtd: Replace DEBUG with MTD_DBG
I came across this when I got compilation errors in USB host driver. I found the errors were because of 'DEBUG' macro in 'mtd.h'. 'mtd.h' was included in SoC specific common header. Unlike MTD, USB subsystem expects DEBUG to be a boolean - be defined or undefined - to on/off DEBUG code. I guess this is common practice in other subsystems as well.
To solve this I thought to replace DEBUG to with MTD_DBG. I am not sure if this is a proper way to do this or not. I am more than willing to change if this can be achieved in a better way.
Thanks,
Tanmay
PS: This patch involves changes in some 'quite old' files, which has code indented with spaces instead of tab. So, checkpatch.pl throws white space errors for a few files.
PATCH 1/1 mtd: Replace DEBUG with MTD_DBG
In reply to Eric MiaoDefining macro 'DEBUG' for debug prints conflicts with other subsystem where defining 'DEBUG' means enable debug code including debug prints and others. So, replaced DEBUG with MTD_DBG for MTD
--- drivers/mtd/chips/cfi_cmdset_0002.c | 24 +++++++++--------- drivers/mtd/chips/fwh_lock.h | 2 +- drivers/mtd/chips/jedec_probe.c | 29 +++++++++++---------- drivers/mtd/devices/doc2000.c | 8 +++--- drivers/mtd/devices/doc2001.c | 4 +- drivers/mtd/devices/doc2001plus.c | 4 +- drivers/mtd/devices/m25p80.c | 20 +++++++------- drivers/mtd/devices/mtd_dataflash.c | 44 ++++++++++++++++---------------- drivers/mtd/devices/sst25l.c | 4 +- drivers/mtd/ftl.c | 41 ++++++++++++++++--------------- drivers/mtd/inftlcore.c | 41 ++++++++++++++++--------------- drivers/mtd/inftlmount.c | 12 ++++---- drivers/mtd/mtdblock.c | 18 +++++++------- drivers/mtd/mtdchar.c | 10 ++++---- drivers/mtd/mtdcore.c | 2 +- drivers/mtd/mtdsuper.c | 21 ++++++++------- drivers/mtd/nand/mxc_nand.c | 12 ++++---- drivers/mtd/nand/nand_base.c | 46 +++++++++++++++++----------------- drivers/mtd/nand/nand_bbt.c | 4 +- drivers/mtd/nand/nand_bch.c | 2 +- drivers/mtd/nand/omap2.c | 8 +++--- drivers/mtd/nand/rtc_from4.c | 3 +- drivers/mtd/nftlcore.c | 33 ++++++++++++++---------- drivers/mtd/onenand/onenand_base.c | 18 +++++++------- drivers/mtd/onenand/onenand_bbt.c | 4 +- drivers/mtd/ssfdc.c | 32 ++++++++++++------------ include/linux/mtd/mtd.h | 4 +- 27 files changed, 230 insertions(+), 220 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +12 -12
@@ -145,7 +145,7 @@ static void fixup_amd_bootblock(struct mtd_info *mtd)if (((major <<8 ) | minor) <0x3131 ) {/* CFI version 1.0 => don't trust bootloc */ -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"%s: JEDEC Vendor ID is 0x%02X Device ID is 0x%02X\n" , map->name, cfi->mfr, cfi->id);
@@ -166,7 +166,7 @@ static void fixup_amd_bootblock(struct mtd_info *mtd)* the 8-bit device ID. */ (cfi->mfr == CFI_MFR_MACRONIX)) { -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"%s: Macronix MX29LV400C with bottom boot block" " detected\n" , map->name); extp->TopBottom =2 ;/* bottom boot */
@@ -178,7 +178,7 @@ static void fixup_amd_bootblock(struct mtd_info *mtd) extp->TopBottom =2 ;/* bottom boot */ } -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"%s: AMD CFI PRI V%c.%c has no boot block field;" " deduced %s from Device ID\n" , map->name, major, minor, extp->TopBottom ==2 ?"bottom" :"top" );
@@ -191,7 +191,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)struct map_info *map = mtd->priv;struct cfi_private *cfi = map->fldrv_priv;if (cfi->cfiq->BufWriteTimeoutTyp) { -DEBUG (MTD_DEBUG_LEVEL1 ,"Using buffer write method\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Using buffer write method\n" ); mtd->write = cfi_amdstd_write_buffers; } }
@@ -443,7 +443,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) mtd->writesize =1 ; mtd->writebufsize =cfi_interleave (cfi) << cfi->cfiq->MaxBufWriteSize; -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): write buffer size %d\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): write buffer size %d\n" , __func__, mtd->writebufsize); mtd->reboot_notifier.notifier_call = cfi_amdstd_reboot;
@@ -1163,7 +1163,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,return ret; } -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): WRITE 0x%.8lx(0x%.8lx)\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): WRITE 0x%.8lx(0x%.8lx)\n" , __func__, adr, datum.x[0 ] );/*
@@ -1174,7 +1174,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,*/ oldd =map_read (map, adr);if (map_word_equal (map, oldd, datum)) { -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): NOP\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): NOP\n" , __func__); goto op_done; }
@@ -1400,7 +1400,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, datum =map_word_load (map, buf); -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): WRITE 0x%.8lx(0x%.8lx)\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): WRITE 0x%.8lx(0x%.8lx)\n" , __func__, adr, datum.x[0 ] );XIP_INVAL_CACHED_RANGE (map, adr, len);
@@ -1587,7 +1587,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip)return ret; } -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): ERASE 0x%.8lx\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): ERASE 0x%.8lx\n" , __func__, chip->start );XIP_INVAL_CACHED_RANGE (map, adr, map->size);
@@ -1675,7 +1675,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,return ret; } -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): ERASE 0x%.8lx\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): ERASE 0x%.8lx\n" , __func__, adr );XIP_INVAL_CACHED_RANGE (map, adr, len);
@@ -1801,7 +1801,7 @@ static int do_atmel_lock(struct map_info *map, struct flchip *chip, goto out_unlock; chip->state =FL_LOCKING ; -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): LOCK 0x%08lx len %d\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): LOCK 0x%08lx len %d\n" , __func__, adr, len); cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi,
@@ -1837,7 +1837,7 @@ static int do_atmel_unlock(struct map_info *map, struct flchip *chip, goto out_unlock; chip->state =FL_UNLOCKING ; -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): LOCK 0x%08lx len %d\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): LOCK 0x%08lx len %d\n" , __func__, adr, len); cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi,
drivers/mtd/chips/fwh_lock.h +1 -1
@@ -34,7 +34,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,/* Refuse the operation if the we cannot look behind the chip */ if (chip->start <0x400000 ) { -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): chip->start: %lx wanted >= 0x400000\n" , __func__, chip->start );return -EIO ;
drivers/mtd/chips/jedec_probe.c +15 -14
@@ -1917,7 +1917,7 @@ static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)* as they will ignore the writes and dont care what address * the F0 is written to */ if (cfi->addr_unlock1) { -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"reset unlock called %x %x \n" , cfi->addr_unlock1,cfi->addr_unlock2);cfi_send_gen_cmd (0xaa , cfi->addr_unlock1, base, map, cfi, cfi->device_type,NULL );
@@ -1941,8 +1941,9 @@ static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int inuint8_t uaddr;if (!(jedec_table[index].devtypes & cfi->device_type)) { -DEBUG (MTD_DEBUG_LEVEL1 ,"Rejecting potential %s with incompatible %d-bit device type\n" , - jedec_table[index].name,4 * (1 <<cfi->device_type)); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Rejecting potential %s with " +"incompatible %d-bit device type\n" , + jedec_table[index].name,4 * (1 <<cfi->device_type));return 0 ; }
@@ -2021,7 +2022,7 @@ static inline int jedec_match( uint32_t base,* there aren't. */ if (finfo->dev_id >0xff ) { -DEBUG (MTD_DEBUG_LEVEL3 ,"%s(): ID is not 8bit\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s(): ID is not 8bit\n" , __func__); goto match_done; }
@@ -2045,11 +2046,11 @@ static inline int jedec_match( uint32_t base, }/* the part size must fit in the memory window */ -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): Check fit 0x%.8x + 0x%.8x = 0x%.8x\n" , __func__, base,1 << finfo->dev_size, base + (1 << finfo->dev_size) );if ( base +cfi_interleave (cfi) * (1 << finfo->dev_size ) > map->size ) { -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): 0x%.4x 0x%.4x %dKiB doesn't fit\n" , __func__, finfo->mfr_id, finfo->dev_id,1 << finfo->dev_size );
@@ -2061,12 +2062,12 @@ static inline int jedec_match( uint32_t base, uaddr = finfo->uaddr; -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): check unlock addrs 0x%.4x 0x%.4x\n" , - __func__, cfi->addr_unlock1, cfi->addr_unlock2 ); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): check unlock addrs 0x%.4x 0x%.4x" +"\n" , __func__, cfi->addr_unlock1, cfi->addr_unlock2);if (MTD_UADDR_UNNECESSARY != uaddr &&MTD_UADDR_DONT_CARE != uaddr && ( unlock_addrs[uaddr].addr1 / cfi->device_type != cfi->addr_unlock1 || unlock_addrs[uaddr].addr2 / cfi->device_type != cfi->addr_unlock2 ) ) { - DEBUG( MTD_DEBUG_LEVEL3, + MTD_DBG(MTD_DEBUG_LEVEL3, "MTD %s(): 0x%.4x 0x%.4x did not match\n", __func__, unlock_addrs[uaddr].addr1,
@@ -2083,14 +2084,14 @@ static inline int jedec_match( uint32_t base,* FIXME - write a driver that takes all of the chip info as * module parameters, doesn't probe but forces a load. */ -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): check ID's disappear when not in ID mode\n" , __func__ );jedec_reset ( base, map, cfi ); mfr =jedec_read_mfr ( map, base, cfi ); id =jedec_read_id ( map, base, cfi );if ( mfr == cfi->mfr && id == cfi->id ) { -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): ID 0x%.2x:0x%.2x did not change after reset:\n" "You might need to manually specify JEDEC parameters.\n" , __func__, cfi->mfr, cfi->id );
@@ -2104,7 +2105,7 @@ static inline int jedec_match( uint32_t base,* Put the device back in ID mode - only need to do this if we * were truly frobbing a real device. */ -DEBUG (MTD_DEBUG_LEVEL3 ,"MTD %s(): return to ID mode\n" , __func__ ); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): return to ID mode\n" , __func__);if (cfi->addr_unlock1) {cfi_send_gen_cmd (0xaa , cfi->addr_unlock1, base, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x55 , cfi->addr_unlock2, base, map, cfi, cfi->device_type,NULL );
@@ -2167,12 +2168,12 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, cfi->mfr =jedec_read_mfr (map, base, cfi); cfi->id =jedec_read_id (map, base, cfi); -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"Search for id:(%02x %02x) interleave(%d) type(%d)\n" , cfi->mfr, cfi->id,cfi_interleave (cfi), cfi->device_type);for (i =0 ; i <ARRAY_SIZE (jedec_table); i++) {if (jedec_match ( base, map, cfi, &jedec_table[i] ) ) { -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n" , __func__, cfi->mfr, cfi->id, cfi->addr_unlock1, cfi->addr_unlock2 );
drivers/mtd/devices/doc2000.c +4 -4
@@ -82,7 +82,7 @@ static int _DoC_WaitReady(struct DiskOnChip *doc)void __iomem *docptr = doc->virtadr;unsigned long timeo = jiffies + (HZ *10 ); -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"_DoC_WaitReady called for out-of-line wait\n" );/* Out-of-line routine to wait for chip response */
@@ -92,7 +92,7 @@ static int _DoC_WaitReady(struct DiskOnChip *doc)DoC_Delay (doc,2 );if (time_after (jiffies, timeo)) { -DEBUG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out.\n" ); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out\n" );return -EIO ; }udelay (1 );
@@ -323,7 +323,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)/* Reset the chip */ if (DoC_Command (doc,NAND_CMD_RESET ,CDSN_CTRL_WP )) { -DEBUG (MTD_DEBUG_LEVEL2 , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"DoC_Command (reset) for %d,%d returned true\n" , floor, chip);return 0 ;
@@ -332,7 +332,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)/* Read the NAND chip ID: 1. Send ReadID command */ if (DoC_Command (doc,NAND_CMD_READID ,CDSN_CTRL_WP )) { -DEBUG (MTD_DEBUG_LEVEL2 , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"DoC_Command (ReadID) for %d,%d returned true\n" , floor, chip);return 0 ;
drivers/mtd/devices/doc2001.c +2 -2
@@ -55,7 +55,7 @@ static int _DoC_WaitReady(void __iomem * docptr) {unsigned short c =0xffff ; -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"_DoC_WaitReady called for out-of-line wait\n" );/* Out-of-line routine to wait for chip response */
@@ -63,7 +63,7 @@ static int _DoC_WaitReady(void __iomem * docptr) ;if (c ==0 ) -DEBUG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out.\n" ); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out.\n" );return (c ==0 ); }
drivers/mtd/devices/doc2001plus.c +2 -2
@@ -61,7 +61,7 @@ static int _DoC_WaitReady(void __iomem * docptr) {unsigned int c =0xffff ; -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"_DoC_WaitReady called for out-of-line wait\n" );/* Out-of-line routine to wait for chip response */
@@ -69,7 +69,7 @@ static int _DoC_WaitReady(void __iomem * docptr) ;if (c ==0 ) -DEBUG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out.\n" ); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"_DoC_WaitReady timed out.\n" );return (c ==0 ); }
drivers/mtd/devices/m25p80.c +10 -10
@@ -209,7 +209,7 @@ static int wait_till_ready(struct m25p *flash)*/ static int erase_chip (struct m25p *flash) { -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: %s %lldKiB\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: %s %lldKiB\n" ,dev_name (&flash->spi->dev), __func__, (long long )(flash->mtd.size >>10 ));
@@ -250,7 +250,7 @@ static int m25p_cmdsz(struct m25p *flash)*/ static int erase_sector (struct m25p *flash,u32 offset) { -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: %s %dKiB at 0x%08x\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: %s %dKiB at 0x%08x\n" ,dev_name (&flash->spi->dev), __func__, flash->mtd.erasesize /1024 , offset);
@@ -286,7 +286,7 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)u32 addr,len;uint32_t rem; -DEBUG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%llx, len %lld\n" , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%llx, len %lld\n" ,dev_name (&flash->spi->dev), __func__,"at" , (long long )instr->addr, (long long )instr->len);
@@ -348,7 +348,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,struct spi_transfer t[2 ];struct spi_message m; -DEBUG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" ,dev_name (&flash->spi->dev), __func__,"from" , (u32 )from, len);
@@ -417,7 +417,7 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,struct spi_transfer t[2 ];struct spi_message m; -DEBUG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" ,dev_name (&flash->spi->dev), __func__,"to" , (u32 )to, len);
@@ -510,7 +510,7 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,size_t actual;int cmd_sz, ret; -DEBUG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"%s: %s %s 0x%08x, len %zd\n" ,dev_name (&flash->spi->dev), __func__,"to" , (u32 )to, len);
@@ -788,7 +788,7 @@ static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)*/ tmp =spi_write_then_read (spi, &code,1 , id,5 );if (tmp <0 ) { -DEBUG (MTD_DEBUG_LEVEL0 ,"%s: error %d reading JEDEC ID\n" , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"%s: error %d reading JEDEC ID\n" ,dev_name (&spi->dev), tmp);return ERR_PTR (tmp); }
@@ -945,7 +945,7 @@ static int __devinit m25p_probe(struct spi_device *spi)dev_info (&spi->dev,"%s (%lld Kbytes)\n" , id->name, (long long )flash->mtd.size >>10 ); - DEBUG(MTD_DEBUG_LEVEL2, + MTD_DBG(MTD_DEBUG_LEVEL2, "mtd .name = %s, .size = 0x%llx (%lldMiB) " ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", flash->mtd.name,
@@ -955,7 +955,7 @@ static int __devinit m25p_probe(struct spi_device *spi)if (flash->mtd.numeraseregions)for (i =0 ; i < flash->mtd.numeraseregions; i++) - DEBUG(MTD_DEBUG_LEVEL2, + MTD_DBG(MTD_DEBUG_LEVEL2, "mtd.eraseregions[%d] = { .offset = 0x%llx, " ".erasesize = 0x%.8x (%uKiB), " ".numblocks = %d }\n",
@@ -990,7 +990,7 @@ static int __devinit m25p_probe(struct spi_device *spi)if (nr_parts >0 ) {for (i =0 ; i < nr_parts; i++) { - DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = " + MTD_DBG(MTD_DEBUG_LEVEL2, "partitions[%d] = " "{.name = %s, .offset = 0x%llx, " ".size = 0x%llx (%lldKiB) }\n", i, parts[i].name,
drivers/mtd/devices/mtd_dataflash.c +22 -22
165 lines not on this page · raw message
drivers/mtd/devices/sst25l.c +2 -2
@@ -414,7 +414,7 @@ static int __devinit sst25l_probe(struct spi_device *spi)dev_info (&spi->dev,"%s (%lld KiB)\n" , flash_info->name, (long long )flash->mtd.size >>10 ); - DEBUG(MTD_DEBUG_LEVEL2, + MTD_DBG(MTD_DEBUG_LEVEL2, "mtd .name = %s, .size = 0x%llx (%lldMiB) " ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", flash->mtd.name,
@@ -438,7 +438,7 @@ static int __devinit sst25l_probe(struct spi_device *spi)if (nr_parts >0 ) {for (i =0 ; i < nr_parts; i++) { - DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = " + MTD_DBG(MTD_DEBUG_LEVEL2, "partitions[%d] = " "{.name = %s, .offset = 0x%llx, " ".size = 0x%llx (%lldKiB) }\n", i, parts[i].name,
drivers/mtd/ftl.c +21 -20
141 lines not on this page · raw message
drivers/mtd/inftlcore.c +21 -20
155 lines not on this page · raw message
drivers/mtd/inftlmount.c +6 -6
@@ -53,7 +53,7 @@ static int find_boot_record(struct INFTLrecord *inftl)struct INFTLPartition *ip;size_t retlen; -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: find_boot_record(inftl=%p)\n" , inftl); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: find_boot_record(inftl=%p)\n" , inftl);/* * Assume logical EraseSize == physical erasesize for starting the
@@ -385,7 +385,7 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block)struct mtd_info *mtd = inftl->mbd.mtd;int physblock; -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: INFTL_formatblock(inftl=%p," +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: INFTL_formatblock(inftl=%p," "block=%d)\n" , inftl, block);memset (instr,0 ,sizeof (struct erase_info ));
@@ -555,7 +555,7 @@ int INFTL_mount(struct INFTLrecord *s)int i;u8 *ANACtable,ANAC ; -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: INFTL_mount(inftl=%p)\n" , s); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: INFTL_mount(inftl=%p)\n" , s);/* Search for INFTL MediaHeader and Spare INFTL Media Header */ if (find_boot_record (s) <0 ) {
@@ -585,7 +585,7 @@ int INFTL_mount(struct INFTLrecord *s)* NOTEXPLORED state. Then@the end we will try to format it and * mark it as free. */ -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 1, explore each unit\n" ); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 1, explore each unit\n" );for (first_block = s->firstEUN; first_block <= s->lastEUN; first_block++) {if (s->PUtable[first_block] !=BLOCK_NOTEXPLORED )continue ;
@@ -727,7 +727,7 @@ int INFTL_mount(struct INFTLrecord *s)* possible because we don't update the previous pointers when * we fold chains. No big deal, just fix them up in PUtable. */ -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 2, validate virtual chains\n" ); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 2, validate virtual chains\n" );for (logical_block =0 ; logical_block < s->numvunits; logical_block++) { block = s->VUtable[logical_block]; last_block =BLOCK_NIL ;
@@ -785,7 +785,7 @@ int INFTL_mount(struct INFTLrecord *s) s->numfreeEUNs =0 ; s->LastFreeEUN =BLOCK_NIL ; -DEBUG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 3, format unused blocks\n" ); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"INFTL: pass 3, format unused blocks\n" );for (block = s->firstEUN; block <= s->lastEUN; block++) {if (s->PUtable[block] ==BLOCK_NOTEXPLORED ) { printk("INFTL: unreferenced block %d, formatting it\n",
drivers/mtd/mtdblock.c +9 -9
@@ -119,7 +119,7 @@ static int write_cached_data (struct mtdblk_dev *mtdblk)if (mtdblk->cache_state !=STATE_DIRTY )return 0 ; -DEBUG (MTD_DEBUG_LEVEL2 ,"mtdblock: writing cached data for \"%s\" " +MTD_DBG (MTD_DEBUG_LEVEL2 ,"mtdblock: writing cached data for \"%s\" " "at 0x%lx, size 0x%x\n" , mtd->name, mtdblk->cache_offset, mtdblk->cache_size);
@@ -148,8 +148,8 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,size_t retlen;int ret; -DEBUG (MTD_DEBUG_LEVEL2 ,"mtdblock: write on \"%s\" at 0x%lx, size 0x%x\n" , - mtd->name, pos, len); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"mtdblock: write on \"%s\" at 0x%lx, size " +"0x%x\n" , mtd->name, pos, len);if (!sect_size)return mtd->write (mtd, pos, len, &retlen, buf);
@@ -218,8 +218,8 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,size_t retlen;int ret; -DEBUG (MTD_DEBUG_LEVEL2 ,"mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n" , - mtd->name, pos, len); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"mtdblock: read on \"%s\" at 0x%lx, size " +"0x%x\n" , mtd->name, pos, len);if (!sect_size)return mtd->read (mtd, pos, len, &retlen, buf);
@@ -283,7 +283,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) { struct mtdblk_dev *mtdblk = container_of(mbd, struct mtdblk_dev, mbd); -DEBUG (MTD_DEBUG_LEVEL1 ,"mtdblock_open\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"mtdblock_open\n" );mutex_lock (&mtdblks_lock);if (mtdblk->count) {
@@ -303,7 +303,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)mutex_unlock (&mtdblks_lock); -DEBUG (MTD_DEBUG_LEVEL1 ,"ok\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"ok\n" );return 0 ; }
@@ -312,7 +312,7 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd) { struct mtdblk_dev *mtdblk = container_of(mbd, struct mtdblk_dev, mbd); -DEBUG (MTD_DEBUG_LEVEL1 ,"mtdblock_release\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"mtdblock_release\n" );mutex_lock (&mtdblks_lock);
@@ -329,7 +329,7 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)mutex_unlock (&mtdblks_lock); -DEBUG (MTD_DEBUG_LEVEL1 ,"ok\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"ok\n" );return 0 ; }
drivers/mtd/mtdchar.c +5 -5
@@ -86,7 +86,7 @@ static int mtd_open(struct inode *inode, struct file *file)struct mtd_file_info *mfi;struct inode *mtd_ino; -DEBUG (MTD_DEBUG_LEVEL0 ,"MTD_open\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MTD_open\n" );/* You can't open the RO devices RW */ if ((file->f_mode &FMODE_WRITE ) && (minor &1 ))
@@ -151,7 +151,7 @@ static int mtd_close(struct inode *inode, struct file *file)struct mtd_file_info *mfi = file->private_data;struct mtd_info *mtd = mfi->mtd; -DEBUG (MTD_DEBUG_LEVEL0 ,"MTD_close\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MTD_close\n" );/* Only sync if opened RW */ if ((file->f_mode &FMODE_WRITE ) && mtd->sync)
@@ -195,7 +195,7 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_tsize_t size = count;char *kbuf; -DEBUG (MTD_DEBUG_LEVEL0 ,"MTD_read\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MTD_read\n" );if (*ppos + count > mtd->size) count = mtd->size - *ppos;
@@ -278,7 +278,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t countint ret=0 ;int len; -DEBUG (MTD_DEBUG_LEVEL0 ,"MTD_write\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MTD_write\n" );if (*ppos == mtd->size)return -ENOSPC ;
@@ -553,7 +553,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)u_long size;struct mtd_info_user info; -DEBUG (MTD_DEBUG_LEVEL0 ,"MTD_ioctl\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MTD_ioctl\n" ); size = (cmd &IOCSIZE_MASK ) >>IOCSIZE_SHIFT ;if (cmd &IOC_IN ) {
drivers/mtd/mtdcore.c +1 -1
@@ -362,7 +362,7 @@ int add_mtd_device(struct mtd_info *mtd)MTD_DEVT (i) +1 , NULL, "mtd%dro", i); -DEBUG (0 ,"mtd: Giving out device %d to %s\n" , i, mtd->name); +MTD_DBG (0 ,"mtd: Giving out device %d to %s\n" , i, mtd->name);/* No need to get a refcount on the module containing the notifier, since we hold the mtd_table_mutex */ list_for_each_entry (not, &mtd_notifiers, list)
drivers/mtd/mtdsuper.c +11 -10
@@ -26,12 +26,12 @@ static int get_sb_mtd_compare(struct super_block *sb, void *_mtd)struct mtd_info *mtd = _mtd;if (sb->s_mtd == mtd) { -DEBUG (2 ,"MTDSB: Match on device %d (\"%s\")\n" , +MTD_DBG (2 ,"MTDSB: Match on device %d (\"%s\")\n" , mtd->index, mtd->name);return 1 ; } -DEBUG (2 ,"MTDSB: No match, device %d (\"%s\"), device %d (\"%s\")\n" , +MTD_DBG (2 ,"MTDSB: No match, device %d (\"%s\"), device %d (\"%s\")\n" , sb->s_mtd->index, sb->s_mtd->name, mtd->index, mtd->name);return 0 ; }
@@ -70,7 +70,7 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, goto already_mounted;/* fresh new superblock */ -DEBUG (1 ,"MTDSB: New superblock for device %d (\"%s\")\n" , +MTD_DBG (1 ,"MTDSB: New superblock for device %d (\"%s\")\n" , mtd->index, mtd->name); sb->s_flags = flags;
@@ -87,7 +87,7 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,/* new mountpoint for an already mounted superblock */ already_mounted: -DEBUG (1 ,"MTDSB: Device %d (\"%s\") is already mounted\n" , +MTD_DBG (1 ,"MTDSB: Device %d (\"%s\") is already mounted\n" , mtd->index, mtd->name);put_mtd_device (mtd);return dget (sb->s_root);
@@ -108,7 +108,8 @@ static struct dentry *mount_mtd_nr(struct file_system_type *fs_type, int flags, mtd =get_mtd_device (NULL , mtdnr);if (IS_ERR (mtd)) { -DEBUG (0 ,"MTDSB: Device #%u doesn't appear to exist\n" , mtdnr); +MTD_DBG (0 ,"MTDSB: Device #%u doesn't appear to exist\n" , + mtdnr);return ERR_CAST (mtd); }
@@ -131,7 +132,7 @@ struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,if (!dev_name)return ERR_PTR (-EINVAL ); -DEBUG (2 ,"MTDSB: dev_name \"%s\"\n" , dev_name); +MTD_DBG (2 ,"MTDSB: dev_name \"%s\"\n" , dev_name);/* the preferred way of mounting in future; especially when * CONFIG_BLOCK=n - we specify the underlying MTD device by number or
@@ -142,7 +143,7 @@ struct dentry *mount_mtd(struct file_system_type *fs_type, int flags,struct mtd_info *mtd;/* mount by MTD device name */ -DEBUG (1 ,"MTDSB: mtd:%%s, name \"%s\"\n" , +MTD_DBG (1 ,"MTDSB: mtd:%%s, name \"%s\"\n" , dev_name +4 ); mtd =get_mtd_device_nm (dev_name +4 );
@@ -163,7 +164,7 @@ struct dentry *mount_mtd(struct file_system_type *fs_type, int flags, mtdnr =simple_strtoul (dev_name +3 , &endptr,0 );if (!*endptr) {/* It was a valid number */ -DEBUG (1 ,"MTDSB: mtd%%d, mtdnr %d\n" , +MTD_DBG (1 ,"MTDSB: mtd%%d, mtdnr %d\n" , mtdnr); return mount_mtd_nr(fs_type, flags, dev_name, data,
@@ -179,10 +180,10 @@ struct dentry *mount_mtd(struct file_system_type *fs_type, int flags, bdev =lookup_bdev (dev_name);if (IS_ERR (bdev)) { ret =PTR_ERR (bdev); -DEBUG (1 ,"MTDSB: lookup_bdev() returned %d\n" , ret); +MTD_DBG (1 ,"MTDSB: lookup_bdev() returned %d\n" , ret);return ERR_PTR (ret); } -DEBUG (1 ,"MTDSB: lookup_bdev() returned 0\n" ); +MTD_DBG (1 ,"MTDSB: lookup_bdev() returned 0\n" ); ret = -EINVAL ;
drivers/mtd/nand/mxc_nand.c +6 -6
@@ -350,7 +350,7 @@ static void wait_op_done(struct mxc_nand_host *host, int useirq)udelay (1 ); }if (max_retries <0 ) -DEBUG (MTD_DEBUG_LEVEL0 ,"%s: INT not set\n" , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"%s: INT not set\n" , __func__); } }
@@ -371,7 +371,7 @@ static void send_cmd_v3(struct mxc_nand_host *host, uint16_t cmd, int useirq)* waits for completion. */ static void send_cmd_v1_v2 (struct mxc_nand_host *host,uint16_t cmd,int useirq) { -DEBUG (MTD_DEBUG_LEVEL3 ,"send_cmd(host, 0x%x, %d)\n" , cmd, useirq); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"send_cmd(host, 0x%x, %d)\n" , cmd, useirq);writew (cmd,NFC_V1_V2_FLASH_CMD );writew (NFC_CMD ,NFC_V1_V2_CONFIG2 );
@@ -387,7 +387,7 @@ static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq)udelay (1 ); }if (max_retries <0 ) -DEBUG (MTD_DEBUG_LEVEL0 ,"%s: RESET failed\n" , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"%s: RESET failed\n" , __func__); }else {/* Wait for operation to complete */
@@ -411,7 +411,7 @@ static void send_addr_v3(struct mxc_nand_host *host, uint16_t addr, int islast)* a NAND command. */ static void send_addr_v1_v2 (struct mxc_nand_host *host,uint16_t addr,int islast) { -DEBUG (MTD_DEBUG_LEVEL3 ,"send_addr(host, 0x%x %d)\n" , addr, islast); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"send_addr(host, 0x%x %d)\n" , addr, islast);writew (addr,NFC_V1_V2_FLASH_ADDR );writew (NFC_ADDR ,NFC_V1_V2_CONFIG2 );
@@ -561,7 +561,7 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,uint16_t ecc_status =readw (NFC_V1_V2_ECC_STATUS_RESULT );if (((ecc_status &0x3 ) ==2 ) || ((ecc_status >>2 ) ==2 )) { -DEBUG (MTD_DEBUG_LEVEL0 , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"MXC_NAND: HWECC uncorrectable 2-bit ECC error\n" );return -1 ; }
@@ -932,7 +932,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,struct nand_chip *nand_chip = mtd->priv;struct mxc_nand_host *host = nand_chip->priv; -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n" , command, column, page_addr);
drivers/mtd/nand/nand_base.c +23 -23
182 lines not on this page · raw message
drivers/mtd/nand/nand_bbt.c +2 -2
@@ -1432,8 +1432,8 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt) block = (int )(offs >> (this->bbt_erase_shift -1 )); res = (this->bbt[block >>3 ] >> (block &0x06 )) &0x03 ; -DEBUG (MTD_DEBUG_LEVEL2 ,"nand_isbad_bbt(): bbt info for offs 0x%08x: (block %d) 0x%02x\n" , - (unsigned int )offs, block >>1 , res); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"nand_isbad_bbt(): bbt info for offs 0x%08x: " +"(block %d) 0x%02x\n" , (unsigned int )offs, block >>1 , res);switch ((int )res) {case 0x00 :
drivers/mtd/nand/nand_bch.c +1 -1
@@ -93,7 +93,7 @@ int nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf, buf[errloc[i] >>3 ] ^= (1 << (errloc[i] &7 ));/* else error in ecc, no action needed */ -DEBUG (MTD_DEBUG_LEVEL0 ,"%s: corrected bitflip %u\n" , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"%s: corrected bitflip %u\n" , __func__, errloc[i]); } }else if (count <0 ) {
drivers/mtd/nand/omap2.c +4 -4
@@ -744,12 +744,12 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */case 1 :/* Uncorrectable error */ -DEBUG (MTD_DEBUG_LEVEL0 ,"ECC UNCORRECTED_ERROR 1\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"ECC UNCORRECTED_ERROR 1\n" );return -1 ;case 11 :/* UN-Correctable error */ -DEBUG (MTD_DEBUG_LEVEL0 ,"ECC UNCORRECTED_ERROR B\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"ECC UNCORRECTED_ERROR B\n" );return -1 ;case 12 :
@@ -766,7 +766,7 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ find_bit = (ecc_bit[5 ] <<2 ) + (ecc_bit[3 ] <<1 ) + ecc_bit[1 ]; -DEBUG (MTD_DEBUG_LEVEL0 ,"Correcting single bit ECC error at " +MTD_DBG (MTD_DEBUG_LEVEL0 ,"Correcting single bit ECC error@" "offset: %d, bit: %d\n" , find_byte, find_bit); page_data[find_byte] ^= (1 << find_bit);
@@ -779,7 +779,7 @@ static int omap_compare_ecc(u8 *ecc_data1, /* read from NAND memory */ ecc_data2[2] == 0)return 0 ; } -DEBUG (MTD_DEBUG_LEVEL0 ,"UNCORRECTED_ERROR default\n" ); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"UNCORRECTED_ERROR default\n" );return -1 ; } }
drivers/mtd/nand/rtc_from4.c +2 -1
@@ -380,7 +380,8 @@ static int rtc_from4_correct_data(struct mtd_info *mtd, const u_char *buf, u_cha/* Let the library code do its magic. */ res =decode_rs8 (rs_decoder, (uint8_t *) buf, par,512 , syn,0 ,NULL ,0xff ,NULL );if (res >0 ) { -DEBUG (MTD_DEBUG_LEVEL0 ,"rtc_from4_correct_data: " "ECC corrected %d errors on read\n" , res); +MTD_DBG (MTD_DEBUG_LEVEL0 ,"rtc_from4_correct_data: " +"ECC corrected %d errors on read\n" , res); }return res; }
drivers/mtd/nftlcore.c +19 -14
@@ -63,7 +63,7 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)return ; } -DEBUG (MTD_DEBUG_LEVEL1 ,"NFTL: add_mtd for %s\n" , mtd->name); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"NFTL: add_mtd for %s\n" , mtd->name); nftl =kzalloc (sizeof (struct NFTLrecord ),GFP_KERNEL );
@@ -132,7 +132,7 @@ static void nftl_remove_dev(struct mtd_blktrans_dev *dev) {struct NFTLrecord *nftl = (void *)dev; -DEBUG (MTD_DEBUG_LEVEL1 ,"NFTL: remove_dev (i=%d)\n" , dev->devnum); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"NFTL: remove_dev (i=%d)\n" , dev->devnum);del_mtd_blktrans_dev (dev);kfree (nftl->ReplUnitTable);
@@ -220,7 +220,8 @@ static u16 NFTL_findfreeblock(struct NFTLrecord *nftl, int desperate )/* Normally, we force a fold to happen before we run out of free blocks completely */ if (!desperate && nftl->numfreeEUNs <2 ) { -DEBUG (MTD_DEBUG_LEVEL1 ,"NFTL_findfreeblock: there are too few free EUNs\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"NFTL_findfreeblock: there are too " +"few free EUNs\n" );return BLOCK_NIL ; }
@@ -291,7 +292,7 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned pif (block ==2 ) { foldmark = oob.u.c.FoldMark | oob.u.c.FoldMark1;if (foldmark ==FOLD_MARK_IN_PROGRESS ) { -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Write Inhibited on EUN %d\n" , thisEUN); inplace =0 ; }else {
@@ -357,8 +358,8 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned pif (BlockLastState[block] !=SECTOR_FREE && BlockMap[block] !=BLOCK_NIL && BlockMap[block] != targetEUN) { - DEBUG(MTD_DEBUG_LEVEL1, "Setting inplace to 0. VUC %d, " - "block %d was %x lastEUN, " + MTD_DBG(MTD_DEBUG_LEVEL1, "Setting inplace to 0" + ". VUC %d, block %d was %x lastEUN, " "and is in EUN %d (%s) %d\n", thisVUC, block, BlockLastState[block], BlockMap[block],
@@ -373,15 +374,15 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p pendingblock < ((thisVUC + 1)* (nftl->EraseSize / 512)) && BlockLastState[pendingblock - (thisVUC * (nftl->EraseSize / 512))] != SECTOR_FREE) { -DEBUG (MTD_DEBUG_LEVEL1 ,"Pending write not free in EUN %d. " -"Folding out of place.\n" , targetEUN); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Pending write not free in " +"EUN %d. Folding out of place.\n" , targetEUN); inplace =0 ; } }if (!inplace) { -DEBUG (MTD_DEBUG_LEVEL1 ,"Cannot fold Virtual Unit Chain %d in place. " -"Trying out-of-place\n" , thisVUC); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Cannot fold Virtual Unit Chain %d " +"in place. Trying out-of-place\n" , thisVUC);/* We need to find a targetEUN to fold into. */ targetEUN =NFTL_findfreeblock (nftl,1 );if (targetEUN ==BLOCK_NIL ) {
@@ -410,7 +411,8 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned pand the Erase Unit into which we are supposed to be copying. Go for it. */ -DEBUG (MTD_DEBUG_LEVEL1 ,"Folding chain %d into unit %d\n" , thisVUC, targetEUN); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Folding chain %d into unit %d\n" , thisVUC, + targetEUN);for (block =0 ; block < nftl->EraseSize /512 ; block++) {unsigned char movebuf[512 ];int ret;
@@ -457,7 +459,7 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned phas duplicate chains, we need to free one of the chains because it's not necessary any more. */ thisEUN = nftl->EUNtable[thisVUC]; -DEBUG (MTD_DEBUG_LEVEL1 ,"Want to erase\n" ); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Want to erase\n" );/* For each block in the old chain (except the targetEUN of course), free it and make it available for future use */
@@ -570,7 +572,8 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block) (writeEUN * nftl->EraseSize) + blockofs, 8, &retlen, (char *)&bci); -DEBUG (MTD_DEBUG_LEVEL2 ,"Status of block %d in EUN %d is %x\n" , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"Status of block %d in EUN %d" +" is %x\n" , block , writeEUN,le16_to_cpu (bci.Status)); status = bci.Status | bci.Status1;
@@ -623,7 +626,9 @@ static inline u16 NFTL_findwriteunit(struct NFTLrecord *nftl, unsigned block)but they are reserved for when we're desperate. Well, now we're desperate. */ -DEBUG (MTD_DEBUG_LEVEL1 ,"Using desperate==1 to find free EUN to accommodate write to VUC %d\n" , thisVUC); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"Using desperate==1 " +"to find free EUN to accommodate write" +" to VUC %d\n" , thisVUC); writeEUN =NFTL_findfreeblock (nftl,1 ); }if (writeEUN ==BLOCK_NIL ) {
drivers/mtd/onenand/onenand_base.c +9 -9
@@ -1122,7 +1122,7 @@ static int onenand_mlc_read_ops_nolock(struct mtd_info *mtd, loff_t from,int ret =0 ;int writesize = this->writesize; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , __func__, (unsigned int ) from, (int ) len);if (ops->mode ==MTD_OOB_AUTO )
@@ -1226,7 +1226,7 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,int ret =0 , boundary =0 ;int writesize = this->writesize; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , __func__, (unsigned int ) from, (int ) len);if (ops->mode ==MTD_OOB_AUTO )
@@ -1357,7 +1357,7 @@ static int onenand_read_oob_nolock(struct mtd_info *mtd, loff_t from, from += ops->ooboffs; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %i\n" , __func__, (unsigned int ) from, (int ) len);/* Initialize return length value */
@@ -1576,7 +1576,7 @@ int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,size_t len = ops->ooblen;u_char *buf = ops->oobbuf; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %zi\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: from = 0x%08x, len = %zi\n" , __func__, (unsigned int ) from, len);/* Initialize return value */
@@ -1750,7 +1750,7 @@ static int onenand_panic_write(struct mtd_info *mtd, loff_t to, size_t len,/* Wait for any existing operation to clear */ onenand_panic_wait (mtd); -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , __func__, (unsigned int ) to, (int ) len);/* Initialize retlen, in case of early exit */
@@ -1883,7 +1883,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,u_char *oobbuf;int ret =0 , cmd; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , __func__, (unsigned int ) to, (int ) len);/* Initialize retlen, in case of early exit */
@@ -2078,7 +2078,7 @@ static int onenand_write_oob_nolock(struct mtd_info *mtd, loff_t to, to += ops->ooboffs; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: to = 0x%08x, len = %i\n" , __func__, (unsigned int ) to, (int ) len);/* Initialize retlen, in case of early exit */
@@ -2489,7 +2489,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)struct mtd_erase_region_info *region =NULL ;loff_t region_offset =0 ; -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: start=0x%012llx, len=%llu\n" , __func__, +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: start=0x%012llx, len=%llu\n" , __func__, (unsigned long long ) instr->addr, (unsigned long long ) instr->len);/* Do not allow erase past end of device */
@@ -2558,7 +2558,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)*/ static void onenand_sync (struct mtd_info *mtd) { -DEBUG (MTD_DEBUG_LEVEL3 ,"%s: called\n" , __func__); +MTD_DBG (MTD_DEBUG_LEVEL3 ,"%s: called\n" , __func__);/* Grab the lock and see if the device is available */ onenand_get_device (mtd,FL_SYNCING );
drivers/mtd/onenand/onenand_bbt.c +2 -2
@@ -153,8 +153,8 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt) block = (int ) (onenand_block (this, offs) <<1 ); res = (bbm->bbt[block >>3 ] >> (block &0x06 )) &0x03 ; -DEBUG (MTD_DEBUG_LEVEL2 ,"onenand_isbad_bbt: bbt info for offs 0x%08x: (block %d) 0x%02x\n" , - (unsigned int ) offs, block >>1 , res); +MTD_DBG (MTD_DEBUG_LEVEL2 ,"onenand_isbad_bbt: bbt info for offs 0x%08x:" +" (block %d) 0x%02x\n" , (unsigned int ) offs, block >>1 , res);switch ((int ) res) {case 0x00 :return 0 ;
drivers/mtd/ssfdc.c +16 -16
@@ -135,7 +135,7 @@ static int get_valid_cis_sector(struct mtd_info *mtd)/* Found */ cis_sector = (int )(offset >>SECTOR_SHIFT ); }else { -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: CIS/IDI sector not found" " on %s (mtd%d)\n" , mtd->name, mtd->index);
@@ -221,7 +221,7 @@ static int get_logical_address(uint8_t *oob_buf) block_address >>=1 ;if (get_parity (block_address,10 ) != parity) { -DEBUG (MTD_DEBUG_LEVEL0 , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"SSFDC_RO: logical address field%d" "parity error(0x%04X)\n" , j+1 , block_address);
@@ -235,7 +235,7 @@ static int get_logical_address(uint8_t *oob_buf)if (!ok) block_address =-2 ; -DEBUG (MTD_DEBUG_LEVEL3 ,"SSFDC_RO: get_logical_address() %d\n" , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"SSFDC_RO: get_logical_address() %d\n" , block_address);return block_address;
@@ -249,8 +249,8 @@ static int build_logical_block_map(struct ssfdcr_record *ssfdc)int ret, block_address, phys_block;struct mtd_info *mtd = ssfdc->mbd.mtd; -DEBUG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: build_block_map() nblks=%d (%luK)\n" , - ssfdc->map_len, +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: build_block_map() nblks=%d (%luK)" +"\n" , ssfdc->map_len, (unsigned long )ssfdc->map_len * ssfdc->erase_size /1024 );/* Scan every physical block, skip CIS block */
@@ -262,7 +262,7 @@ static int build_logical_block_map(struct ssfdcr_record *ssfdc) ret =read_raw_oob (mtd, offset, oob_buf);if (ret <0 ) { -DEBUG (MTD_DEBUG_LEVEL0 , +MTD_DBG (MTD_DEBUG_LEVEL0 ,"SSFDC_RO: mtd read_oob() failed@%lu\n" , offset);return -1 ;
@@ -279,7 +279,7 @@ static int build_logical_block_map(struct ssfdcr_record *ssfdc) ssfdc->logic_block_map[block_address] = (unsigned short )phys_block; -DEBUG (MTD_DEBUG_LEVEL2 , +MTD_DBG (MTD_DEBUG_LEVEL2 ,"SSFDC_RO: build_block_map() phys_block=%d," "logic_block_addr=%d, zone=%d\n" , phys_block, block_address, zone_index);
@@ -319,7 +319,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) ssfdc->erase_size = mtd->erasesize; ssfdc->map_len = (u32 )mtd->size / mtd->erasesize; -DEBUG (MTD_DEBUG_LEVEL1 , +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: cis_block=%d,erase_size=%d,map_len=%d,n_zones=%d\n" , ssfdc->cis_block, ssfdc->erase_size, ssfdc->map_len,DIV_ROUND_UP (ssfdc->map_len,MAX_PHYS_BLK_PER_ZONE ));
@@ -331,8 +331,8 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) ssfdc->cylinders = (unsigned short )(((u32 )mtd->size >>SECTOR_SHIFT ) / ((long )ssfdc->sectors * (long )ssfdc->heads)); -DEBUG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: using C:%d H:%d S:%d == %ld sects\n" , - ssfdc->cylinders, ssfdc->heads , ssfdc->sectors, +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: using C:%d H:%d S:%d == %ld sects" +"\n" , ssfdc->cylinders, ssfdc->heads , ssfdc->sectors, (long )ssfdc->cylinders * (long )ssfdc->heads * (long )ssfdc->sectors);
@@ -371,7 +371,7 @@ static void ssfdcr_remove_dev(struct mtd_blktrans_dev *dev) {struct ssfdcr_record *ssfdc = (struct ssfdcr_record *)dev; -DEBUG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: remove_dev (i=%d)\n" , dev->devnum); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: remove_dev (i=%d)\n" , dev->devnum);del_mtd_blktrans_dev (dev);kfree (ssfdc->logic_block_map);
@@ -387,7 +387,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev, offset = (int )(logic_sect_no % sectors_per_block); block_address = (int )(logic_sect_no / sectors_per_block); -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"SSFDC_RO: ssfdcr_readsect(%lu) sec_per_blk=%d, ofst=%d," " block_addr=%d\n" , logic_sect_no, sectors_per_block, offset, block_address);
@@ -397,7 +397,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev, block_address = ssfdc->logic_block_map[block_address]; -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"SSFDC_RO: ssfdcr_readsect() phys_block_addr=%d\n" , block_address);
@@ -407,7 +407,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev, sect_no = (unsigned long )block_address * sectors_per_block + offset; -DEBUG (MTD_DEBUG_LEVEL3 , +MTD_DBG (MTD_DEBUG_LEVEL3 ,"SSFDC_RO: ssfdcr_readsect() phys_sect_no=%lu\n" , sect_no);
@@ -424,8 +424,8 @@ static int ssfdcr_getgeo(struct mtd_blktrans_dev *dev, struct hd_geometry *geo) {struct ssfdcr_record *ssfdc = (struct ssfdcr_record *)dev; -DEBUG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: ssfdcr_getgeo() C=%d, H=%d, S=%d\n" , - ssfdc->cylinders, ssfdc->heads, ssfdc->sectors); +MTD_DBG (MTD_DEBUG_LEVEL1 ,"SSFDC_RO: ssfdcr_getgeo() C=%d, H=%d, S=%d\n" + , ssfdc->cylinders, ssfdc->heads, ssfdc->sectors); geo->heads = ssfdc->heads; geo->sectors = ssfdc->sectors;
include/linux/mtd/mtd.h +2 -2
@@ -364,13 +364,13 @@ void mtd_erase_callback(struct erase_info *instr);#define MTD_DEBUG_LEVEL3 (3)/* Noisy */ #ifdef CONFIG_MTD_DEBUG -#define DEBUG(n, args...) \ +#define MTD_DBG(n, args...) \ do { \ if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ printk(KERN_INFO args); \ } while(0)#else /* CONFIG_MTD_DEBUG */ -#define DEBUG(n, args...) \ +#define MTD_DBG(n, args...) \ do { \ if (0) \ printk(KERN_INFO args); \
Signature · 1 line
1.7.0.4
PATCH 1/1 mtd: Replace DEBUG with MTD_DBG
Quoted 3 lines · Tanmay Upadhyay
Defining macro 'DEBUG' for debug prints conflicts with other subsystem where defining 'DEBUG' means enable debug code including debug prints and others. So, replaced DEBUG with
MTD_DBGfor MTD
DEBUG was killed from MTD recently in the subsystem tree for MTD, l2-mtd-2.6.git:git://git.infradead.org/users/dedekind/l2-mtd-2.6.git
The fix *should* be merged in the next merge window, so this patch is unnecessary.
Brian
PATCH 1/1 mtd: Replace DEBUG with MTD_DBG
Quoted 5 lines · Brian Norris
Quoted 3 lines · Tanmay Upadhyay
Defining macro 'DEBUG' for debug prints conflicts with other subsystem where defining 'DEBUG' means enable debug code including debug prints and others. So, replaced DEBUG with
MTD_DBGfor MTD
Quoted 9 lines
DEBUG was killed from MTD recently in the subsystem tree for MTD, l2-mtd-2.6.git:
git://git.infradead.org/users/dedekind/l2-mtd-2.6.gitThe fix *should* be merged in the next merge window, so this patch is unnecessary.
Brian
Thanks for the information. Glad to see pr_debug replacing DEBUG. :)
Regards,
Tanmay
PATCH 2/3 USB: pxa168: Add onchip USB host controller support
In reply to Tanmay Upadhyay- Add EHCI Host controller driver
- Add wrapper that creates resources for host controller driver
--- arch/arm/mach-mmp/include/mach/pxa168.h | 7 + arch/arm/mach-mmp/pxa168.c | 46 ++++ drivers/usb/Kconfig | 1 + drivers/usb/host/Kconfig | 7 + drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-pxa168.c | 362 +++++++++++++++++++++++++++++++ 6 files changed, 428 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-pxa168.c
arch/arm/mach-mmp/include/mach/pxa168.h +7 -0
@@ -35,6 +35,13 @@ extern struct pxa_device_desc pxa168_device_fb;extern struct pxa_device_desc pxa168_device_keypad;extern struct pxa_device_desc pxa168_device_eth; +struct pxa168_usb_pdata { +/* If NULL, default phy init routine for PXA168 would be called */ +int (*phy_init)(void __iomem *usb_phy_reg_base); +}; +/* pdata can be NULL */ +int __init pxa168_add_usb_host (struct pxa168_usb_pdata *pdata); +static inline int pxa168_add_uart (int id) {struct pxa_device_desc *d =NULL ;
arch/arm/mach-mmp/pxa168.c +46 -0
67 lines not on this page · raw message
drivers/usb/Kconfig +1 -0
@@ -67,6 +67,7 @@ config USB_ARCH_HAS_EHCI default y if PLAT_SPEAR default y if ARCH_MSM default y if MICROBLAZE + default y if ARCH_MMP default PCI # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
drivers/usb/host/Kconfig +7 -0
@@ -529,3 +529,10 @@ config USB_OCTEON_OHCI config USB_OCTEON2_COMMON bool default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI + +config USB_PXA168_EHCI + bool "Marvell PXA168 on-chip EHCI HCD support" + depends on USB_EHCI_HCD && ARCH_MMP + help + Enable support for Marvell PXA168 SoC's on-chip EHCI + host controller
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1265,6 +1265,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER tegra_ehci_driver#endif +#ifdef CONFIG_USB_PXA168_EHCI +#include "ehci-pxa168.c" +#define PLATFORM_DRIVER ehci_pxa168_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-pxa168.c new file +362 -0
362 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/3 USB: pxa168: Add onchip USB host controller support
Quoted 508 lines · Tanmay Upadhyay
- Add EHCI Host controller driver
- Add wrapper that creates resources for host controller driverSigned-off-by Tanmay Upadhyay<[email protected]>--- arch/arm/mach-mmp/include/mach/pxa168.h | 7 + arch/arm/mach-mmp/pxa168.c | 46 ++++ drivers/usb/Kconfig | 1 + drivers/usb/host/Kconfig | 7 + drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-pxa168.c | 362 +++++++++++++++++++++++++++++++ 6 files changed, 428 insertions(+), 0 deletions(-)create mode 100644
drivers/usb/host/ehci-pxa168.carch/arm/mach-mmp/include/mach/pxa168.h +7
-0@@ -35,6 +35,13 @@ extern struct pxa_device_desc pxa168_device_fb;extern struct pxa_device_desc pxa168_device_keypad;extern struct pxa_device_desc pxa168_device_eth; +struct pxa168_usb_pdata { +/* If NULL, default phy init routine for PXA168 would be called */ +int (*phy_init)(void __iomem *usb_phy_reg_base); +}; +/* pdata can be NULL */ +int __init pxa168_add_usb_host (struct pxa168_usb_pdata *pdata); +static inline int pxa168_add_uart (int id) {struct pxa_device_desc *d =NULL ;arch/arm/mach-mmp/pxa168.c +46
-0@@ -25,6 +25,9 @@#include <mach/dma.h> #include <mach/devices.h> #include <mach/mfp.h> +#include <linux/platform_device.h> +#include <linux/dma-mapping.h> +#include <mach/pxa168.h> #include "common.h" #include "clock.h" @@ -83,6 +86,7 @@ static APBC_CLK(keypad, PXA168_KPC, 0, 32000); static APMU_CLK(nand, NAND, 0x01db, 208000000); static APMU_CLK(lcd, LCD, 0x7f, 312000000); static APMU_CLK(eth, ETH, 0x09, 0); +static APMU_CLK(usb, USB, 0x12, 0);/* device and clock bindings */ static struct clk_lookup pxa168_clkregs[] = {@@ -104,6 +108,7 @@ static struct clk_lookup pxa168_clkregs[] = {INIT_CLKREG (&clk_lcd,"pxa168-fb" ,NULL ),INIT_CLKREG (&clk_keypad,"pxa27x-keypad" ,NULL ),INIT_CLKREG (&clk_eth,"pxa168-eth" ,"MFUCLK" ), + INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"), };static int __init pxa168_init (void )@@ -169,3 +174,44 @@ PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);PXA168_DEVICE (fb,"pxa168-fb" ,-1 ,LCD ,0xd420b000 ,0x1c8 );PXA168_DEVICE (keypad,"pxa27x-keypad" ,-1 ,KEYPAD ,0xd4012000 ,0x4c );PXA168_DEVICE (eth,"pxa168-eth" ,-1 ,MFU ,0xc0800000 ,0x0fff ); + +struct resource pxa168_usb_host_resources[] = { +/* USB Host conroller register base */ + [0 ] = { + .start =0xd4209000 , + .end =0xd4209000 +0x200 , + .flags =IORESOURCE_MEM , + .name ="pxa168-usb-host" , + }, +/* USB PHY register base */ + [1 ] = { + .start =0xd4206000 , + .end =0xd4206000 +0xff , + .flags =IORESOURCE_MEM , + .name ="pxa168-usb-phy" , + }, + [2 ] = { + .start =IRQ_PXA168_USB2 , + .end =IRQ_PXA168_USB2 , + .flags =IORESOURCE_IRQ , + }, +}; + +static u64 pxa168_usb_host_dmamask =DMA_BIT_MASK (32 ); +struct platform_device pxa168_device_usb_host = { + .name ="pxa168-ehci" , + .id =-1 , + .dev = { + .dma_mask =&pxa168_usb_host_dmamask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + }, + + .num_resources =ARRAY_SIZE (pxa168_usb_host_resources), + .resource = pxa168_usb_host_resources, +}; + +int __init pxa168_add_usb_host (struct pxa168_usb_pdata *pdata) +{ + pxa168_device_usb_host.dev.platform_data = pdata; +return platform_device_register (&pxa168_device_usb_host); +}drivers/usb/Kconfig +1
-0@@ -67,6 +67,7 @@ config USB_ARCH_HAS_EHCI default y if PLAT_SPEAR default y if ARCH_MSM default y if MICROBLAZE + default y if ARCH_MMP default PCI # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.drivers/usb/host/Kconfig +7
-0@@ -529,3 +529,10 @@ config USB_OCTEON_OHCI config USB_OCTEON2_COMMON bool default y if USB_OCTEON_EHCI || USB_OCTEON_OHCI + +config USB_PXA168_EHCI + bool "Marvell PXA168 on-chip EHCI HCD support" + depends on USB_EHCI_HCD&& ARCH_MMP + help + Enable support for Marvell PXA168 SoC's on-chip EHCI + host controllerdrivers/usb/host/ehci-hcd.c +5
-0@@ -1265,6 +1265,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER tegra_ehci_driver#endif +#ifdef CONFIG_USB_PXA168_EHCI +#include "ehci-pxa168.c" +#define PLATFORM_DRIVER ehci_pxa168_driver +#endif +#if !defined(PCI_DRIVER )&& !defined(PLATFORM_DRIVER )&& \ !defined(PS3_SYSTEM_BUS_DRIVER )&& !defined(OF_PLATFORM_DRIVER )&& \ !defined(XILINX_OF_PLATFORM_DRIVER )drivers/usb/host/ehci-pxa168.c new file +352
-0@@ -0,0 +1,362 @@ +/* +* drivers/usb/host/ehci-pxa168.c +* +* Tanmay Upadhyay<[email protected]> +* +* Based on drivers/usb/host/ehci-orion.c +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <mach/pxa168.h> + +#define USB_PHY_CTRL_REG 0x4 +#define USB_PHY_PLL_REG 0x8 +#define USB_PHY_TX_REG 0xc + +#define FBDIV_SHIFT 4 + +#define ICP_SHIFT 12 +#define ICP_15 2 +#define ICP_20 3 +#define ICP_25 4 + +#define KVCO_SHIFT 15 + +#define PLLCALI12_SHIFT 25 +#define CALI12_VDD 0 +#define CALI12_09 1 +#define CALI12_10 2 +#define CALI12_11 3 + +#define PLLVDD12_SHIFT 27 +#define VDD12_VDD 0 +#define VDD12_10 1 +#define VDD12_11 2 +#define VDD12_12 3 + +#define PLLVDD18_SHIFT 29 +#define VDD18_19 0 +#define VDD18_20 1 +#define VDD18_21 2 +#define VDD18_22 3 + + +#define PLL_READY (1<< 23) +#define VCOCAL_START (1<< 21) +#define REG_RCAL_START (1<< 12) + +struct pxa168_usb_drv_data { +struct ehci_hcd ehci; +struct clk *pxa168_usb_clk; +struct resource *usb_phy_res; +void __iomem *usb_phy_reg_base; +}; + +static int ehci_pxa168_setup (struct usb_hcd *hcd) +{ +struct ehci_hcd *ehci =hcd_to_ehci (hcd); +int retval; + +ehci_reset (ehci); + retval =ehci_halt (ehci); +if (retval) +return retval; + +/* +* data structure init +*/ + retval =ehci_init (hcd); +if (retval) +return retval; + + hcd->has_tt =1 ; + +ehci_port_power (ehci,0 ); + +return retval; +} + +static const struct hc_driver ehci_pxa168_hc_driver = { + .description = hcd_name, + .product_desc ="Marvell PXA168 EHCI" , + .hcd_priv_size =sizeof (struct pxa168_usb_drv_data ), + +/* +* generic hardware linkage +*/ + .irq = ehci_irq, + .flags =HCD_MEMORY |HCD_USB2 , + +/* +* basic lifecycle operations +*/ + .reset = ehci_pxa168_setup, + .start = ehci_run, + .stop = ehci_stop, + .shutdown = ehci_shutdown, + +/* +* managing i/o requests and associated device resources +*/ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .endpoint_reset = ehci_endpoint_reset, + +/* +* scheduling support +*/ + .get_frame_number = ehci_get_frame, + +/* +* root hub support +*/ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, +}; + +static int pxa168_usb_phy_init (struct platform_device *pdev) +{ +struct resource *res; +void __iomem *usb_phy_reg_base; +struct pxa168_usb_pdata *pdata; +struct pxa168_usb_drv_data *drv_data; +struct usb_hcd *hcd =platform_get_drvdata (pdev); +unsigned long reg_val; +int pll_retry_cont =10000 , err =0 ; + + drv_data = (struct pxa168_usb_drv_data *)hcd->hcd_priv; + pdata = (struct pxa168_usb_pdata *)pdev->dev.platform_data; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!res) { +dev_err (&pdev->dev, +"Found HC with no PHY register addr. Check %s setup!\n" , +dev_name (&pdev->dev)); +return -ENODEV ; + } + +if (!request_mem_region (res->start,resource_size (res), + ehci_pxa168_hc_driver.description)) { +dev_dbg (&pdev->dev,"controller already in use\n" ); +return -EBUSY ; + } + + usb_phy_reg_base =ioremap (res->start,resource_size (res)); +if (usb_phy_reg_base ==NULL ) { +dev_dbg (&pdev->dev,"error mapping memory\n" ); + err = -EFAULT ; + goto err1; + } + drv_data->usb_phy_reg_base = usb_phy_reg_base; + drv_data->usb_phy_res = res; + +/* If someone wants to init USB phy in board specific way */ +if (pdata&& pdata->phy_init) +return pdata->phy_init (usb_phy_reg_base); + +/* Power up the PHY and PLL */ +writel (readl (usb_phy_reg_base +USB_PHY_CTRL_REG ) |0x3 , + usb_phy_reg_base +USB_PHY_CTRL_REG ); + +/* Configure PHY PLL */ + reg_val =readl (usb_phy_reg_base +USB_PHY_PLL_REG )& ~(0x7e03ffff ); + reg_val |= (VDD18_22 <<PLLVDD18_SHIFT |VDD12_12 <<PLLVDD12_SHIFT | +CALI12_11 <<PLLCALI12_SHIFT |3 <<KVCO_SHIFT | +ICP_15 <<ICP_SHIFT |0xee <<FBDIV_SHIFT |0xb ); +writel (reg_val, usb_phy_reg_base +USB_PHY_PLL_REG ); + +/* Make sure PHY PLL is ready */ +while (!(readl (usb_phy_reg_base +USB_PHY_PLL_REG )&PLL_READY )) { +if (!(pll_retry_cont--)) { +dev_dbg (&pdev->dev,"USB PHY PLL not ready\n" ); + err = -EIO ; + goto err2; + } + } + +/* Toggle VCOCAL_START bit of U2PLL for PLL calibration */ +udelay (200 ); +writel (readl (usb_phy_reg_base +USB_PHY_PLL_REG ) |VCOCAL_START , + usb_phy_reg_base +USB_PHY_PLL_REG ); +udelay (40 ); +writel (readl (usb_phy_reg_base +USB_PHY_PLL_REG )& ~VCOCAL_START , + usb_phy_reg_base +USB_PHY_PLL_REG ); + +/* Toggle REG_RCAL_START bit of U2PTX for impedance calibration */ +udelay (400 ); +writel (readl (usb_phy_reg_base +USB_PHY_TX_REG ) |REG_RCAL_START , + usb_phy_reg_base +USB_PHY_TX_REG ); +udelay (40 ); +writel (readl (usb_phy_reg_base +USB_PHY_TX_REG )& ~REG_RCAL_START , + usb_phy_reg_base +USB_PHY_TX_REG ); + +/* Make sure PHY PLL is ready again */ + pll_retry_cont =0 ; +while (!(readl (usb_phy_reg_base +USB_PHY_PLL_REG )&PLL_READY )) { +if (!(pll_retry_cont--)) { +dev_dbg (&pdev->dev,"USB PHY PLL not ready\n" ); + err = -EIO ; + goto err2; + } + } + +return 0 ; +err2: +iounmap (usb_phy_reg_base); +err1: +release_mem_region (res->start,resource_size (res)); +return err; +} + +static int __devinit ehci_pxa168_drv_probe (struct platform_device *pdev) +{ +struct resource *res; +struct usb_hcd *hcd; +struct ehci_hcd *ehci; +struct pxa168_usb_drv_data *drv_data; +void __iomem *regs; +int irq, err =0 ; + +if (usb_disabled ()) +return -ENODEV ; + +pr_debug ("Initializing pxa168-SoC USB Host Controller\n" ); + + irq =platform_get_irq (pdev,0 ); +if (irq<=0 ) { +dev_err (&pdev->dev, +"Found HC with no IRQ. Check %s setup!\n" , +dev_name (&pdev->dev)); + err = -ENODEV ; + goto err1; + } + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { +dev_err (&pdev->dev, +"Found HC with no register addr. Check %s setup!\n" , +dev_name (&pdev->dev)); + err = -ENODEV ; + goto err1; + } + +if (!request_mem_region (res->start,resource_size (res), + ehci_pxa168_hc_driver.description)) { +dev_dbg (&pdev->dev,"controller already in use\n" ); + err = -EBUSY ; + goto err1; + } + + regs =ioremap (res->start,resource_size (res)); +if (regs ==NULL ) { +dev_dbg (&pdev->dev,"error mapping memory\n" ); + err = -EFAULT ; + goto err2; + } + + hcd =usb_create_hcd (&ehci_pxa168_hc_driver, + &pdev->dev,dev_name (&pdev->dev)); +if (!hcd) { + err = -ENOMEM ; + goto err3; + } + + drv_data = (struct pxa168_usb_drv_data *)hcd->hcd_priv; + +/* Enable USB clock */ + drv_data->pxa168_usb_clk =clk_get (&pdev->dev,"PXA168-USBCLK" ); +if (IS_ERR (drv_data->pxa168_usb_clk)) { +dev_err (&pdev->dev,"Couldn't get USB clock\n" ); + err =PTR_ERR (drv_data->pxa168_usb_clk); + goto err4; + } +clk_enable (drv_data->pxa168_usb_clk); + + err =pxa168_usb_phy_init (pdev); +if (err) { +dev_err (&pdev->dev,"USB PHY initialization failed\n" ); + goto err5; + } + + hcd->rsrc_start = res->start; + hcd->rsrc_len =resource_size (res); + hcd->regs = regs; + + ehci =hcd_to_ehci (hcd); + ehci->caps = hcd->regs +0x100 ; + ehci->regs = hcd->regs +0x100 + +HC_LENGTH (ehci_readl (ehci,&ehci->caps->hc_capbase)); + ehci->hcs_params =ehci_readl (ehci,&ehci->caps->hcs_params); + hcd->has_tt =1 ; + ehci->sbrn =0x20 ; + + err =usb_add_hcd (hcd, irq,IRQF_SHARED |IRQF_DISABLED ); +if (err) + goto err5; + +return 0 ; + +err5: +clk_disable (drv_data->pxa168_usb_clk); +err4: +usb_put_hcd (hcd); +err3: +iounmap (regs); +err2: +release_mem_region (res->start,resource_size (res)); +err1: +dev_err (&pdev->dev,"init %s fail, %d\n" , +dev_name (&pdev->dev), err); + +return err; +} + +static int __exit ehci_pxa168_drv_remove(struct platform_device *pdev) +{ +struct usb_hcd *hcd =platform_get_drvdata (pdev); +struct pxa168_usb_drv_data *drv_data = + (struct pxa168_usb_drv_data *)hcd->hcd_priv; + +usb_remove_hcd (hcd); + +/* Power down PHY& PLL */ +writel (readl (drv_data->usb_phy_reg_base +USB_PHY_CTRL_REG )& (~0x3 ), + drv_data->usb_phy_reg_base +USB_PHY_CTRL_REG ); + +clk_disable (drv_data->pxa168_usb_clk); +clk_put (drv_data->pxa168_usb_clk); + +iounmap (hcd->regs); +release_mem_region (hcd->rsrc_start, hcd->rsrc_len); + +iounmap (drv_data->usb_phy_reg_base); +release_mem_region (drv_data->usb_phy_res->start, +resource_size (drv_data->usb_phy_res)); + +usb_put_hcd (hcd); + +return 0 ;
drivers/usb/host/ehci-pxa168.c line 362
Quoted 10 lines
drivers/usb/host/ehci-pxa168.c new file +10
-0+} + +MODULE_ALIAS ("platform:pxa168-ehci" ); + +static struct platform_driver ehci_pxa168_driver = { + .probe = ehci_pxa168_drv_probe, + .remove =__exit_p (ehci_pxa168_drv_remove), + .shutdown = usb_hcd_platform_shutdown, + .driver.name ="pxa168-ehci" , +};
It was sad to know that David Brownell is no more with us. Added new maintainer for EHCI - Alan Stern in loop.
PATCH 3/3 ARM: pxa168: Add USB support for gplugD board
In reply to Tanmay Upadhyay--- arch/arm/mach-mmp/gplugd.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/gplugd.c +1 -0
@@ -186,6 +186,7 @@ static void __init gplugd_init(void)pxa168_add_twsi (0 ,NULL ,ARRAY_AND_SIZE (gplugd_i2c_board_info));pxa168_add_eth (&gplugd_eth_platform_data); +pxa168_add_usb_host (NULL ); }MACHINE_START (SHEEVAD ,"PXA168-based GuruPlug Display (gplugD) Platform" )
Signature · 1 line
1.7.0.4