Commit ad3258ed authored by David S. Miller's avatar David S. Miller

Merge cheetah.(none):/home/davem/src/BK/sparcwork-2.6

into cheetah.(none):/home/davem/src/BK/sparc-2.6
parents 89a5508e e878a1dd
...@@ -92,10 +92,7 @@ Technical changes: ...@@ -92,10 +92,7 @@ Technical changes:
i2c_get_clientdata(client) instead. i2c_get_clientdata(client) instead.
* [Interface] Init function should not print anything. Make sure * [Interface] Init function should not print anything. Make sure
there is a MODULE_LICENSE() line. MODULE_PARM() is replaced there is a MODULE_LICENSE() line.
by module_param(). Note that module_param has a third parameter,
that you should set to 0 by default. See include/linux/moduleparam.h
for details.
Coding policy: Coding policy:
......
/* /*
* Architecture-specific unaligned trap handling. * Architecture-specific unaligned trap handling.
* *
* Copyright (C) 1999-2002 Hewlett-Packard Co * Copyright (C) 1999-2002, 2004 Hewlett-Packard Co
* Stephane Eranian <eranian@hpl.hp.com> * Stephane Eranian <eranian@hpl.hp.com>
* David Mosberger-Tang <davidm@hpl.hp.com> * David Mosberger-Tang <davidm@hpl.hp.com>
* *
...@@ -1328,7 +1328,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) ...@@ -1328,7 +1328,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
* handler into reading an arbitrary kernel addresses... * handler into reading an arbitrary kernel addresses...
*/ */
if (!user_mode(regs)) if (!user_mode(regs))
eh = SEARCH_EXCEPTION_TABLE(regs); eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
if (user_mode(regs) || eh) { if (user_mode(regs) || eh) {
if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0) if ((current->thread.flags & IA64_THREAD_UAC_SIGBUS) != 0)
goto force_sigbus; goto force_sigbus;
......
/* /*
* Kernel exception handling table support. Derived from arch/alpha/mm/extable.c. * Kernel exception handling table support. Derived from arch/alpha/mm/extable.c.
* *
* Copyright (C) 1998, 1999, 2001-2002 Hewlett-Packard Co * Copyright (C) 1998, 1999, 2001-2002, 2004 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com> * David Mosberger-Tang <davidm@hpl.hp.com>
*/ */
...@@ -10,9 +10,51 @@ ...@@ -10,9 +10,51 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/module.h> #include <asm/module.h>
void sort_extable(struct exception_table_entry *start, static inline int
struct exception_table_entry *finish) compare_entries (struct exception_table_entry *l, struct exception_table_entry *r)
{ {
u64 lip = (u64) &l->addr + l->addr;
u64 rip = (u64) &r->addr + r->addr;
if (lip < rip)
return -1;
if (lip == rip)
return 0;
else
return 1;
}
static inline void
swap_entries (struct exception_table_entry *l, struct exception_table_entry *r)
{
u64 delta = (u64) r - (u64) l;
struct exception_table_entry tmp;
tmp = *l;
l->addr = r->addr + delta;
l->cont = r->cont + delta;
r->addr = tmp.addr - delta;
r->cont = tmp.cont - delta;
}
/*
* Sort the exception table. It's usually already sorted, but there may be unordered
* entries due to multiple text sections (such as the .init text section). Note that the
* exception-table-entries contain location-relative addresses, which requires a bit of
* care during sorting to avoid overflows in the offset members (e.g., it would not be
* safe to make a temporary copy of an exception-table entry on the stack, because the
* stack may be more than 2GB away from the exception-table).
*/
void
sort_extable (struct exception_table_entry *start, struct exception_table_entry *finish)
{
struct exception_table_entry *p, *q;
/* insertion sort */
for (p = start + 1; p < finish; ++p)
/* start .. p-1 is sorted; push p down to it's proper place */
for (q = p; q > start && compare_entries(&q[0], &q[-1]) < 0; --q)
swap_entries(&q[0], &q[-1]);
} }
const struct exception_table_entry * const struct exception_table_entry *
......
...@@ -58,7 +58,7 @@ mapped_kernel_page_is_present (unsigned long address) ...@@ -58,7 +58,7 @@ mapped_kernel_page_is_present (unsigned long address)
if (pgd_none(*pgd) || pgd_bad(*pgd)) if (pgd_none(*pgd) || pgd_bad(*pgd))
return 0; return 0;
pmd = pmd_offset(pgd,address); pmd = pmd_offset(pgd, address);
if (pmd_none(*pmd) || pmd_bad(*pmd)) if (pmd_none(*pmd) || pmd_bad(*pmd))
return 0; return 0;
......
...@@ -55,5 +55,4 @@ void sort_extable(struct exception_table_entry *start, ...@@ -55,5 +55,4 @@ void sort_extable(struct exception_table_entry *start,
} }
} }
} while (change != 0); } while (change != 0);
return 0;
} }
...@@ -75,7 +75,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) ...@@ -75,7 +75,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
continue; continue;
} }
if (nodeid >= numnodes) { if (nodeid >= numnodes) {
printk("Ignoring excess node %d (%x:%x)\n", nodeid, printk("Ignoring excess node %d (%lx:%lx)\n", nodeid,
base, limit); base, limit);
continue; continue;
} }
......
...@@ -868,7 +868,7 @@ int cpufreq_update_policy(unsigned int cpu) ...@@ -868,7 +868,7 @@ int cpufreq_update_policy(unsigned int cpu)
down(&data->lock); down(&data->lock);
memcpy(&policy, memcpy(&policy,
&data, data,
sizeof(struct cpufreq_policy)); sizeof(struct cpufreq_policy));
policy.min = data->user_policy.min; policy.min = data->user_policy.min;
policy.max = data->user_policy.max; policy.max = data->user_policy.max;
......
...@@ -67,12 +67,13 @@ static struct adapter_parm adapter_parm[] = { ...@@ -67,12 +67,13 @@ static struct adapter_parm adapter_parm[] = {
.getsda = { 0x40, STAT, 1 }, .getsda = { 0x40, STAT, 1 },
.getscl = { 0x08, STAT, 1 }, .getscl = { 0x08, STAT, 1 },
}, },
/* type 4: ADM 1032 evaluation board */ /* type 4: ADM1025 and ADM1032 evaluation boards */
{ {
.setsda = { 0x02, DATA, 1 }, .setsda = { 0x02, DATA, 1 },
.setscl = { 0x01, DATA, 1 }, .setscl = { 0x01, DATA, 1 },
.getsda = { 0x10, STAT, 1 }, .getsda = { 0x10, STAT, 1 },
.init = { 0xf0, DATA, 0 }, .init = { 0xf0, DATA, 0 }, /* ADM1025 doesn't need this,
but it doesn't hurt */
}, },
}; };
...@@ -84,4 +85,4 @@ MODULE_PARM_DESC(type, ...@@ -84,4 +85,4 @@ MODULE_PARM_DESC(type,
" 1 = home brew teletext adapter\n" " 1 = home brew teletext adapter\n"
" 2 = Velleman K8000 adapter\n" " 2 = Velleman K8000 adapter\n"
" 3 = ELV adapter\n" " 3 = ELV adapter\n"
" 4 = ADM 1032 evalulation board\n"); " 4 = ADM1025 and ADM1032 evaluation boards\n");
...@@ -184,8 +184,8 @@ static void i2c_parport_attach (struct parport *port) ...@@ -184,8 +184,8 @@ static void i2c_parport_attach (struct parport *port)
return; return;
} }
/* reset hardware to sane state */ /* reset hardware to sane state */
bit_lp_setsda(port, 1); adapter->bit_lp_data.setsda(port, 1);
bit_lp_setscl(port, 1); adapter->bit_lp_data.setscl(port, 1);
parport_release(adapter->pdev); parport_release(adapter->pdev);
if (i2c_bit_add_bus(&adapter->adapter) < 0) { if (i2c_bit_add_bus(&adapter->adapter) < 0) {
......
...@@ -68,6 +68,9 @@ struct sd { ...@@ -68,6 +68,9 @@ struct sd {
#define SMBSLVEVT (0xA + piix4_smba) #define SMBSLVEVT (0xA + piix4_smba)
#define SMBSLVDAT (0xC + piix4_smba) #define SMBSLVDAT (0xC + piix4_smba)
/* count for request_region */
#define SMBIOSIZE 8
/* PCI Address Constants */ /* PCI Address Constants */
#define SMBBA 0x090 #define SMBBA 0x090
#define SMBHSTCFG 0x0D2 #define SMBHSTCFG 0x0D2
...@@ -112,14 +115,13 @@ MODULE_PARM_DESC(fix_hstcfg, ...@@ -112,14 +115,13 @@ MODULE_PARM_DESC(fix_hstcfg,
static int piix4_transaction(void); static int piix4_transaction(void);
static unsigned short piix4_smba = 0; static unsigned short piix4_smba = 0;
static struct i2c_adapter piix4_adapter; static struct i2c_adapter piix4_adapter;
/* /*
* Get DMI information. * Get DMI information.
*/ */
static int ibm_dmi_probe(void) static int __devinit ibm_dmi_probe(void)
{ {
#ifdef CONFIG_X86 #ifdef CONFIG_X86
extern int is_unsafe_smbus; extern int is_unsafe_smbus;
...@@ -129,9 +131,9 @@ static int ibm_dmi_probe(void) ...@@ -129,9 +131,9 @@ static int ibm_dmi_probe(void)
#endif #endif
} }
static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id) static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
const struct pci_device_id *id)
{ {
int error_return = 0;
unsigned char temp; unsigned char temp;
/* match up the function */ /* match up the function */
...@@ -144,8 +146,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id ...@@ -144,8 +146,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
dev_err(&PIIX4_dev->dev, "IBM Laptop detected; this module " dev_err(&PIIX4_dev->dev, "IBM Laptop detected; this module "
"may corrupt your serial eeprom! Refusing to load " "may corrupt your serial eeprom! Refusing to load "
"module!\n"); "module!\n");
error_return = -EPERM; return -EPERM;
goto END;
} }
/* Determine the address of the SMBus areas */ /* Determine the address of the SMBus areas */
...@@ -163,11 +164,10 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id ...@@ -163,11 +164,10 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
} }
} }
if (!request_region(piix4_smba, 8, "piix4-smbus")) { if (!request_region(piix4_smba, SMBIOSIZE, "piix4-smbus")) {
dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n", dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n",
piix4_smba); piix4_smba);
error_return = -ENODEV; return -ENODEV;
goto END;
} }
pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp); pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp);
...@@ -214,8 +214,9 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id ...@@ -214,8 +214,9 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
} else { } else {
dev_err(&PIIX4_dev->dev, dev_err(&PIIX4_dev->dev,
"Host SMBus controller not enabled!\n"); "Host SMBus controller not enabled!\n");
error_return = -ENODEV; release_region(piix4_smba, SMBIOSIZE);
goto END; piix4_smba = 0;
return -ENODEV;
} }
} }
...@@ -231,8 +232,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id ...@@ -231,8 +232,7 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
dev_dbg(&PIIX4_dev->dev, "SMBREV = 0x%X\n", temp); dev_dbg(&PIIX4_dev->dev, "SMBREV = 0x%X\n", temp);
dev_dbg(&PIIX4_dev->dev, "SMBA = 0x%X\n", piix4_smba); dev_dbg(&PIIX4_dev->dev, "SMBA = 0x%X\n", piix4_smba);
END: return 0;
return error_return;
} }
/* Another internally used function */ /* Another internally used function */
...@@ -465,7 +465,8 @@ static struct pci_device_id piix4_ids[] = { ...@@ -465,7 +465,8 @@ static struct pci_device_id piix4_ids[] = {
{ 0, } { 0, }
}; };
static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit piix4_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{ {
int retval; int retval;
...@@ -479,17 +480,24 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id ...@@ -479,17 +480,24 @@ static int __devinit piix4_probe(struct pci_dev *dev, const struct pci_device_id
snprintf(piix4_adapter.name, I2C_NAME_SIZE, snprintf(piix4_adapter.name, I2C_NAME_SIZE,
"SMBus PIIX4 adapter at %04x", piix4_smba); "SMBus PIIX4 adapter at %04x", piix4_smba);
retval = i2c_add_adapter(&piix4_adapter); if ((retval = i2c_add_adapter(&piix4_adapter))) {
dev_err(&dev->dev, "Couldn't register adapter!\n");
release_region(piix4_smba, SMBIOSIZE);
piix4_smba = 0;
}
return retval; return retval;
} }
static void __devexit piix4_remove(struct pci_dev *dev) static void __devexit piix4_remove(struct pci_dev *dev)
{ {
i2c_del_adapter(&piix4_adapter); if (piix4_smba) {
i2c_del_adapter(&piix4_adapter);
release_region(piix4_smba, SMBIOSIZE);
piix4_smba = 0;
}
} }
static struct pci_driver piix4_driver = { static struct pci_driver piix4_driver = {
.name = "piix4-smbus", .name = "piix4-smbus",
.id_table = piix4_ids, .id_table = piix4_ids,
...@@ -502,15 +510,13 @@ static int __init i2c_piix4_init(void) ...@@ -502,15 +510,13 @@ static int __init i2c_piix4_init(void)
return pci_module_init(&piix4_driver); return pci_module_init(&piix4_driver);
} }
static void __exit i2c_piix4_exit(void) static void __exit i2c_piix4_exit(void)
{ {
pci_unregister_driver(&piix4_driver); pci_unregister_driver(&piix4_driver);
release_region(piix4_smba, 8);
} }
MODULE_AUTHOR MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and "
("Frodo Looijaard <frodol@dds.nl> and Philip Edelbrock <phil@netroedge.com>"); "Philip Edelbrock <phil@netroedge.com>");
MODULE_DESCRIPTION("PIIX4 SMBus driver"); MODULE_DESCRIPTION("PIIX4 SMBus driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -104,9 +104,9 @@ static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ ...@@ -104,9 +104,9 @@ static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \
set(temp_max, LM75_REG_TEMP_OS); set(temp_max, LM75_REG_TEMP_OS);
set(temp_hyst, LM75_REG_TEMP_HYST); set(temp_hyst, LM75_REG_TEMP_HYST);
static DEVICE_ATTR(temp_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); static DEVICE_ATTR(temp_max1, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max);
static DEVICE_ATTR(temp_hyst, S_IWUSR | S_IRUGO, show_temp_hyst, set_temp_hyst); static DEVICE_ATTR(temp_hyst1, S_IWUSR | S_IRUGO, show_temp_hyst, set_temp_hyst);
static DEVICE_ATTR(temp_input, S_IRUGO, show_temp_input, NULL); static DEVICE_ATTR(temp_input1, S_IRUGO, show_temp_input, NULL);
static int lm75_attach_adapter(struct i2c_adapter *adapter) static int lm75_attach_adapter(struct i2c_adapter *adapter)
{ {
...@@ -197,9 +197,9 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -197,9 +197,9 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
lm75_init_client(new_client); lm75_init_client(new_client);
/* Register sysfs hooks */ /* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_temp_max); device_create_file(&new_client->dev, &dev_attr_temp_max1);
device_create_file(&new_client->dev, &dev_attr_temp_hyst); device_create_file(&new_client->dev, &dev_attr_temp_hyst1);
device_create_file(&new_client->dev, &dev_attr_temp_input); device_create_file(&new_client->dev, &dev_attr_temp_input1);
return 0; return 0;
......
...@@ -369,10 +369,10 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count) ...@@ -369,10 +369,10 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count)
return count; return count;
} }
static DEVICE_ATTR(temp_input, S_IRUGO, show_temp, NULL) static DEVICE_ATTR(temp_input1, S_IRUGO, show_temp, NULL)
static DEVICE_ATTR(temp_max, S_IRUGO | S_IWUSR, static DEVICE_ATTR(temp_max1, S_IRUGO | S_IWUSR,
show_temp_over, set_temp_over) show_temp_over, set_temp_over)
static DEVICE_ATTR(temp_hyst, S_IRUGO | S_IWUSR, static DEVICE_ATTR(temp_hyst1, S_IRUGO | S_IWUSR,
show_temp_hyst, set_temp_hyst) show_temp_hyst, set_temp_hyst)
/* 3 Fans */ /* 3 Fans */
...@@ -678,9 +678,9 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -678,9 +678,9 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file(&new_client->dev, &dev_attr_in_input6); device_create_file(&new_client->dev, &dev_attr_in_input6);
device_create_file(&new_client->dev, &dev_attr_in_min6); device_create_file(&new_client->dev, &dev_attr_in_min6);
device_create_file(&new_client->dev, &dev_attr_in_max6); device_create_file(&new_client->dev, &dev_attr_in_max6);
device_create_file(&new_client->dev, &dev_attr_temp_input); device_create_file(&new_client->dev, &dev_attr_temp_input1);
device_create_file(&new_client->dev, &dev_attr_temp_max); device_create_file(&new_client->dev, &dev_attr_temp_max1);
device_create_file(&new_client->dev, &dev_attr_temp_hyst); device_create_file(&new_client->dev, &dev_attr_temp_hyst1);
device_create_file(&new_client->dev, &dev_attr_fan_input1); device_create_file(&new_client->dev, &dev_attr_fan_input1);
device_create_file(&new_client->dev, &dev_attr_fan_min1); device_create_file(&new_client->dev, &dev_attr_fan_min1);
device_create_file(&new_client->dev, &dev_attr_fan_div1); device_create_file(&new_client->dev, &dev_attr_fan_div1);
......
...@@ -48,9 +48,6 @@ static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END }; ...@@ -48,9 +48,6 @@ static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
/* Insmod parameters */ /* Insmod parameters */
SENSORS_INSMOD_4(lm85b, lm85c, adm1027, adt7463); SENSORS_INSMOD_4(lm85b, lm85c, adm1027, adt7463);
/* Enable debug if true */
static int lm85debug = 0;
/* The LM85 registers */ /* The LM85 registers */
#define LM85_REG_IN(nr) (0x20 + (nr)) #define LM85_REG_IN(nr) (0x20 + (nr))
...@@ -802,19 +799,15 @@ int lm85_detect(struct i2c_adapter *adapter, int address, ...@@ -802,19 +799,15 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
company = lm85_read_value(new_client, LM85_REG_COMPANY); company = lm85_read_value(new_client, LM85_REG_COMPANY);
verstep = lm85_read_value(new_client, LM85_REG_VERSTEP); verstep = lm85_read_value(new_client, LM85_REG_VERSTEP);
if (lm85debug) { dev_dbg(&adapter->dev, "Detecting device at %d,0x%02x with"
printk("lm85: Detecting device at %d,0x%02x with"
" COMPANY: 0x%02x and VERSTEP: 0x%02x\n", " COMPANY: 0x%02x and VERSTEP: 0x%02x\n",
i2c_adapter_id(new_client->adapter), new_client->addr, i2c_adapter_id(new_client->adapter), new_client->addr,
company, verstep); company, verstep);
}
/* If auto-detecting, Determine the chip type. */ /* If auto-detecting, Determine the chip type. */
if (kind <= 0) { if (kind <= 0) {
if (lm85debug) { dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x ...\n",
printk("lm85: Autodetecting device at %d,0x%02x ...\n",
i2c_adapter_id(adapter), address ); i2c_adapter_id(adapter), address );
}
if( company == LM85_COMPANY_NATIONAL if( company == LM85_COMPANY_NATIONAL
&& verstep == LM85_VERSTEP_LM85C ) { && verstep == LM85_VERSTEP_LM85C ) {
kind = lm85c ; kind = lm85c ;
...@@ -823,8 +816,8 @@ int lm85_detect(struct i2c_adapter *adapter, int address, ...@@ -823,8 +816,8 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
kind = lm85b ; kind = lm85b ;
} else if( company == LM85_COMPANY_NATIONAL } else if( company == LM85_COMPANY_NATIONAL
&& (verstep & 0xf0) == LM85_VERSTEP_GENERIC ) { && (verstep & 0xf0) == LM85_VERSTEP_GENERIC ) {
printk("lm85: Unrecgonized version/stepping 0x%02x" dev_err(&adapter->dev, "Unrecgonized version/stepping 0x%02x"
" Defaulting to LM85.\n", verstep ); " Defaulting to LM85.\n", verstep);
kind = any_chip ; kind = any_chip ;
} else if( company == LM85_COMPANY_ANALOG_DEV } else if( company == LM85_COMPANY_ANALOG_DEV
&& verstep == LM85_VERSTEP_ADM1027 ) { && verstep == LM85_VERSTEP_ADM1027 ) {
...@@ -834,21 +827,19 @@ int lm85_detect(struct i2c_adapter *adapter, int address, ...@@ -834,21 +827,19 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
kind = adt7463 ; kind = adt7463 ;
} else if( company == LM85_COMPANY_ANALOG_DEV } else if( company == LM85_COMPANY_ANALOG_DEV
&& (verstep & 0xf0) == LM85_VERSTEP_GENERIC ) { && (verstep & 0xf0) == LM85_VERSTEP_GENERIC ) {
printk("lm85: Unrecgonized version/stepping 0x%02x" dev_err(&adapter->dev, "Unrecgonized version/stepping 0x%02x"
" Defaulting to ADM1027.\n", verstep ); " Defaulting to ADM1027.\n", verstep);
kind = adm1027 ; kind = adm1027 ;
} else if( kind == 0 && (verstep & 0xf0) == 0x60) { } else if( kind == 0 && (verstep & 0xf0) == 0x60) {
printk("lm85: Generic LM85 Version 6 detected\n"); dev_err(&adapter->dev, "Generic LM85 Version 6 detected\n");
/* Leave kind as "any_chip" */ /* Leave kind as "any_chip" */
} else { } else {
if (lm85debug) { dev_dbg(&adapter->dev, "Autodetection failed\n");
printk("lm85: Autodetection failed\n");
}
/* Not an LM85 ... */ /* Not an LM85 ... */
if( kind == 0 ) { /* User used force=x,y */ if( kind == 0 ) { /* User used force=x,y */
printk("lm85: Generic LM85 Version 6 not" dev_err(&adapter->dev, "Generic LM85 Version 6 not"
" found at %d,0x%02x. Try force_lm85c.\n", " found at %d,0x%02x. Try force_lm85c.\n",
i2c_adapter_id(adapter), address ); i2c_adapter_id(adapter), address );
} }
err = 0 ; err = 0 ;
goto ERROR1; goto ERROR1;
...@@ -879,12 +870,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address, ...@@ -879,12 +870,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
data->valid = 0; data->valid = 0;
init_MUTEX(&data->update_lock); init_MUTEX(&data->update_lock);
if (lm85debug) { dev_dbg(&adapter->dev, "Assigning ID %d to %s at %d,0x%02x\n",
printk("lm85: Assigning ID %d to %s at %d,0x%02x\n",
new_client->id, new_client->name, new_client->id, new_client->name,
i2c_adapter_id(new_client->adapter), i2c_adapter_id(new_client->adapter),
new_client->addr); new_client->addr);
}
/* Tell the I2C layer a new client has arrived */ /* Tell the I2C layer a new client has arrived */
if ((err = i2c_attach_client(new_client))) if ((err = i2c_attach_client(new_client)))
...@@ -1021,31 +1010,24 @@ void lm85_init_client(struct i2c_client *client) ...@@ -1021,31 +1010,24 @@ void lm85_init_client(struct i2c_client *client)
int value; int value;
struct lm85_data *data = i2c_get_clientdata(client); struct lm85_data *data = i2c_get_clientdata(client);
if (lm85debug) { dev_dbg(&client->dev, "Initializing device\n");
printk("lm85(%d): Initializing device\n", client->id);
}
/* Warn if part was not "READY" */ /* Warn if part was not "READY" */
value = lm85_read_value(client, LM85_REG_CONFIG); value = lm85_read_value(client, LM85_REG_CONFIG);
if (lm85debug) { dev_dbg(&client->dev, "LM85_REG_CONFIG is: 0x%02x\n", value);
printk("lm85(%d): LM85_REG_CONFIG is: 0x%02x\n", client->id, value );
}
if( value & 0x02 ) { if( value & 0x02 ) {
printk("lm85(%d): Client (%d,0x%02x) config is locked.\n", dev_err(&client->dev, "Client (%d,0x%02x) config is locked.\n",
client->id,
i2c_adapter_id(client->adapter), client->addr ); i2c_adapter_id(client->adapter), client->addr );
}; };
if( ! (value & 0x04) ) { if( ! (value & 0x04) ) {
printk("lm85(%d): Client (%d,0x%02x) is not ready.\n", dev_err(&client->dev, "Client (%d,0x%02x) is not ready.\n",
client->id,
i2c_adapter_id(client->adapter), client->addr ); i2c_adapter_id(client->adapter), client->addr );
}; };
if( value & 0x10 if( value & 0x10
&& ( data->type == adm1027 && ( data->type == adm1027
|| data->type == adt7463 ) ) { || data->type == adt7463 ) ) {
printk("lm85(%d): Client (%d,0x%02x) VxI mode is set. " dev_err(&client->dev, "Client (%d,0x%02x) VxI mode is set. "
"Please report this to the lm85 maintainer.\n", "Please report this to the lm85 maintainer.\n",
client->id,
i2c_adapter_id(client->adapter), client->addr ); i2c_adapter_id(client->adapter), client->addr );
}; };
...@@ -1061,11 +1043,8 @@ void lm85_init_client(struct i2c_client *client) ...@@ -1061,11 +1043,8 @@ void lm85_init_client(struct i2c_client *client)
value = lm85_read_value(client, LM85_REG_CONFIG); value = lm85_read_value(client, LM85_REG_CONFIG);
/* Try to clear LOCK, Set START, save everything else */ /* Try to clear LOCK, Set START, save everything else */
value = (value & ~ 0x02) | 0x01 ; value = (value & ~ 0x02) | 0x01 ;
if (lm85debug) { dev_dbg(&client->dev, "Setting CONFIG to: 0x%02x\n", value);
printk("lm85(%d): Setting CONFIG to: 0x%02x\n", client->id, value );
}
lm85_write_value(client, LM85_REG_CONFIG, value); lm85_write_value(client, LM85_REG_CONFIG, value);
} }
void lm85_update_client(struct i2c_client *client) void lm85_update_client(struct i2c_client *client)
...@@ -1078,10 +1057,8 @@ void lm85_update_client(struct i2c_client *client) ...@@ -1078,10 +1057,8 @@ void lm85_update_client(struct i2c_client *client)
if ( !data->valid || if ( !data->valid ||
(jiffies - data->last_reading > LM85_DATA_INTERVAL ) ) { (jiffies - data->last_reading > LM85_DATA_INTERVAL ) ) {
/* Things that change quickly */ /* Things that change quickly */
dev_dbg(&client->dev, "Reading sensor values\n");
if (lm85debug) {
printk("lm85(%d): Reading sensor values\n", client->id);
}
/* Have to read extended bits first to "freeze" the /* Have to read extended bits first to "freeze" the
* more significant bits that are read later. * more significant bits that are read later.
*/ */
...@@ -1125,10 +1102,8 @@ void lm85_update_client(struct i2c_client *client) ...@@ -1125,10 +1102,8 @@ void lm85_update_client(struct i2c_client *client)
if ( !data->valid || if ( !data->valid ||
(jiffies - data->last_config > LM85_CONFIG_INTERVAL) ) { (jiffies - data->last_config > LM85_CONFIG_INTERVAL) ) {
/* Things that don't change often */ /* Things that don't change often */
dev_dbg(&client->dev, "Reading config values\n");
if (lm85debug) {
printk("lm85(%d): Reading config values\n", client->id);
}
for (i = 0; i <= 4; ++i) { for (i = 0; i <= 4; ++i) {
data->in_min[i] = data->in_min[i] =
lm85_read_value(client, LM85_REG_IN_MIN(i)); lm85_read_value(client, LM85_REG_IN_MIN(i));
...@@ -1234,8 +1209,6 @@ static void __exit sm_lm85_exit(void) ...@@ -1234,8 +1209,6 @@ static void __exit sm_lm85_exit(void)
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>"); MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>");
MODULE_DESCRIPTION("LM85-B, LM85-C driver"); MODULE_DESCRIPTION("LM85-B, LM85-C driver");
MODULE_PARM(lm85debug, "i");
MODULE_PARM_DESC(lm85debug, "Enable debugging statements");
module_init(sm_lm85_init); module_init(sm_lm85_init);
module_exit(sm_lm85_exit); module_exit(sm_lm85_exit);
...@@ -7,7 +7,7 @@ menu "USB support" ...@@ -7,7 +7,7 @@ menu "USB support"
# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
config USB config USB
tristate "Support for USB" tristate "Support for USB"
depends on PCI || SA1111 depends on PCI || SA1111 || ARCH_OMAP1510 || ARCH_OMAP1610
---help--- ---help---
Universal Serial Bus (USB) is a specification for a serial bus Universal Serial Bus (USB) is a specification for a serial bus
subsystem which offers higher speeds and more features than the subsystem which offers higher speeds and more features than the
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "usb.h"
#include "hcd.h" #include "hcd.h"
#include "hub.h" #include "hub.h"
...@@ -1316,8 +1317,8 @@ int usb_physical_reset_device(struct usb_device *dev) ...@@ -1316,8 +1317,8 @@ int usb_physical_reset_device(struct usb_device *dev)
kfree(descriptor); kfree(descriptor);
usb_destroy_configuration(dev); usb_destroy_configuration(dev);
ret = usb_get_device_descriptor(dev); ret = usb_get_device_descriptor(dev, sizeof(dev->descriptor));
if (ret < sizeof(dev->descriptor)) { if (ret != sizeof(dev->descriptor)) {
if (ret < 0) if (ret < 0)
err("unable to get device %s descriptor " err("unable to get device %s descriptor "
"(error=%d)", dev->devpath, ret); "(error=%d)", dev->devpath, ret);
......
...@@ -546,10 +546,10 @@ void usb_sg_cancel (struct usb_sg_request *io) ...@@ -546,10 +546,10 @@ void usb_sg_cancel (struct usb_sg_request *io)
* *
* Gets a USB descriptor. Convenience functions exist to simplify * Gets a USB descriptor. Convenience functions exist to simplify
* getting some types of descriptors. Use * getting some types of descriptors. Use
* usb_get_device_descriptor() for USB_DT_DEVICE, * usb_get_device_descriptor() for USB_DT_DEVICE (not exported),
* and usb_get_string() or usb_string() for USB_DT_STRING. * and usb_get_string() or usb_string() for USB_DT_STRING.
* Configuration descriptors (USB_DT_CONFIG) are part of the device * Device (USB_DT_DEVICE) and configuration descriptors (USB_DT_CONFIG)
* structure, at least for the current configuration. * are part of the device structure.
* In addition to a number of USB-standard descriptors, some * In addition to a number of USB-standard descriptors, some
* devices also use class-specific or vendor-specific descriptors. * devices also use class-specific or vendor-specific descriptors.
* *
...@@ -610,6 +610,7 @@ int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char ...@@ -610,6 +610,7 @@ int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char
/** /**
* usb_get_device_descriptor - (re)reads the device descriptor * usb_get_device_descriptor - (re)reads the device descriptor
* @dev: the device whose device descriptor is being updated * @dev: the device whose device descriptor is being updated
* @size: how much of the descriptor to read
* Context: !in_interrupt () * Context: !in_interrupt ()
* *
* Updates the copy of the device descriptor stored in the device structure, * Updates the copy of the device descriptor stored in the device structure,
...@@ -618,24 +619,35 @@ int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char ...@@ -618,24 +619,35 @@ int usb_get_string(struct usb_device *dev, unsigned short langid, unsigned char
* vendors product and version fields (idVendor, idProduct, and bcdDevice). * vendors product and version fields (idVendor, idProduct, and bcdDevice).
* That lets device drivers compare against non-byteswapped constants. * That lets device drivers compare against non-byteswapped constants.
* *
* There's normally no need to use this call, although some devices * Not exported, only for use by the core. If drivers really want to read
* will change their descriptors after events like updating firmware. * the device descriptor directly, they can call usb_get_descriptor() with
* type = USB_DT_DEVICE and index = 0.
* *
* This call is synchronous, and may not be used in an interrupt context. * This call is synchronous, and may not be used in an interrupt context.
* *
* Returns the number of bytes received on success, or else the status code * Returns the number of bytes received on success, or else the status code
* returned by the underlying usb_control_msg() call. * returned by the underlying usb_control_msg() call.
*/ */
int usb_get_device_descriptor(struct usb_device *dev) int usb_get_device_descriptor(struct usb_device *dev, unsigned int size)
{ {
int ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, struct usb_device_descriptor *desc;
sizeof(dev->descriptor)); int ret;
if (size > sizeof(*desc))
return -EINVAL;
desc = kmalloc(sizeof(*desc), GFP_NOIO);
if (!desc)
return -ENOMEM;
ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, size);
if (ret >= 0) { if (ret >= 0) {
le16_to_cpus(&dev->descriptor.bcdUSB); le16_to_cpus(&desc->bcdUSB);
le16_to_cpus(&dev->descriptor.idVendor); le16_to_cpus(&desc->idVendor);
le16_to_cpus(&dev->descriptor.idProduct); le16_to_cpus(&desc->idProduct);
le16_to_cpus(&dev->descriptor.bcdDevice); le16_to_cpus(&desc->bcdDevice);
memcpy(&dev->descriptor, desc, size);
} }
kfree(desc);
return ret; return ret;
} }
...@@ -1241,7 +1253,6 @@ EXPORT_SYMBOL(usb_sg_wait); ...@@ -1241,7 +1253,6 @@ EXPORT_SYMBOL(usb_sg_wait);
// synchronous control message convenience routines // synchronous control message convenience routines
EXPORT_SYMBOL(usb_get_descriptor); EXPORT_SYMBOL(usb_get_descriptor);
EXPORT_SYMBOL(usb_get_device_descriptor);
EXPORT_SYMBOL(usb_get_status); EXPORT_SYMBOL(usb_get_status);
EXPORT_SYMBOL(usb_get_string); EXPORT_SYMBOL(usb_get_string);
EXPORT_SYMBOL(usb_string); EXPORT_SYMBOL(usb_string);
......
...@@ -206,12 +206,15 @@ void usb_deregister(struct usb_driver *driver) ...@@ -206,12 +206,15 @@ void usb_deregister(struct usb_driver *driver)
*/ */
struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum) struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum)
{ {
struct usb_host_config *config = dev->actconfig;
int i; int i;
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) if (!config)
if (dev->actconfig->interface[i]->altsetting[0] return NULL;
for (i = 0; i < config->desc.bNumInterfaces; i++)
if (config->interface[i]->altsetting[0]
.desc.bInterfaceNumber == ifnum) .desc.bInterfaceNumber == ifnum)
return dev->actconfig->interface[i]; return config->interface[i];
return NULL; return NULL;
} }
...@@ -233,14 +236,17 @@ struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum) ...@@ -233,14 +236,17 @@ struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum)
struct usb_endpoint_descriptor * struct usb_endpoint_descriptor *
usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum) usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum)
{ {
struct usb_host_config *config = dev->actconfig;
int i, k; int i, k;
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { if (!config)
return NULL;
for (i = 0; i < config->desc.bNumInterfaces; i++) {
struct usb_interface *intf; struct usb_interface *intf;
struct usb_host_interface *alt; struct usb_host_interface *alt;
/* only endpoints in current altseting are active */ /* only endpoints in current altsetting are active */
intf = dev->actconfig->interface[i]; intf = config->interface[i];
alt = intf->altsetting + intf->act_altsetting; alt = intf->altsetting + intf->act_altsetting;
for (k = 0; k < alt->desc.bNumEndpoints; k++) for (k = 0; k < alt->desc.bNumEndpoints; k++)
...@@ -1059,7 +1065,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1059,7 +1065,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
wait_ms(10); /* Let the SET_ADDRESS settle */ wait_ms(10); /* Let the SET_ADDRESS settle */
/* high and low speed devices don't need this... */ /* high and low speed devices don't need this... */
err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8); err = usb_get_device_descriptor(dev, 8);
if (err >= 8) if (err >= 8)
break; break;
wait_ms(100); wait_ms(100);
...@@ -1079,8 +1085,8 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1079,8 +1085,8 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
/* USB device state == addressed ... still not usable */ /* USB device state == addressed ... still not usable */
err = usb_get_device_descriptor(dev); err = usb_get_device_descriptor(dev, sizeof(dev->descriptor));
if (err < (signed)sizeof(dev->descriptor)) { if (err != (signed)sizeof(dev->descriptor)) {
dev_err(&dev->dev, "device descriptor read/all, error %d\n", err); dev_err(&dev->dev, "device descriptor read/all, error %d\n", err);
goto fail; goto fail;
} }
......
...@@ -14,3 +14,6 @@ extern void usb_enable_endpoint (struct usb_device *dev, ...@@ -14,3 +14,6 @@ extern void usb_enable_endpoint (struct usb_device *dev,
struct usb_endpoint_descriptor *epd); struct usb_endpoint_descriptor *epd);
extern void usb_enable_interface (struct usb_device *dev, extern void usb_enable_interface (struct usb_device *dev,
struct usb_interface *intf); struct usb_interface *intf);
extern int usb_get_device_descriptor(struct usb_device *dev,
unsigned int size);
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
# (a) a peripheral controller, and # (a) a peripheral controller, and
# (b) the gadget driver using it. # (b) the gadget driver using it.
# #
# for 2.5 kbuild, drivers/usb/gadget/Kconfig menu "USB Gadget Support"
# source this at the end of drivers/usb/Kconfig
# config USB_GADGET
menuconfig USB_GADGET
tristate "Support for USB Gadgets" tristate "Support for USB Gadgets"
depends on EXPERIMENTAL
help help
USB is a master/slave protocol, organized with one master USB is a master/slave protocol, organized with one master
host (such as a PC) controlling up to 127 peripheral devices. host (such as a PC) controlling up to 127 peripheral devices.
...@@ -36,12 +34,15 @@ menuconfig USB_GADGET ...@@ -36,12 +34,15 @@ menuconfig USB_GADGET
# USB Peripheral Controller Support # USB Peripheral Controller Support
# #
choice choice
prompt "USB Peripheral Controller Support" prompt "USB Peripheral Controller"
depends on USB_GADGET depends on USB_GADGET
help
A USB device uses a controller to talk to its host.
Systems should have only one such upstream link.
config USB_NET2280 config USB_GADGET_NET2280
tristate "NetChip 2280 USB Peripheral Controller" boolean "NetChip 2280"
depends on PCI && USB_GADGET depends on PCI
help help
NetChip 2280 is a PCI based USB peripheral controller which NetChip 2280 is a PCI based USB peripheral controller which
supports both full and high speed USB 2.0 data transfers. supports both full and high speed USB 2.0 data transfers.
...@@ -54,21 +55,91 @@ config USB_NET2280 ...@@ -54,21 +55,91 @@ config USB_NET2280
dynamically linked module called "net2280" and force all dynamically linked module called "net2280" and force all
gadget drivers to also be dynamically linked. gadget drivers to also be dynamically linked.
config USB_NET2280
tristate
depends on USB_GADGET_NET2280
default USB_GADGET
config USB_GADGET_PXA2XX
boolean "PXA 2xx or IXP 42x"
depends on ARCH_PXA || ARCH_IXP425
help
Intel's PXA 2xx series XScale ARM-5TE processors include
an integrated full speed USB 1.1 device controller. The
controller in the IXP 4xx series is register-compatible.
It has fifteen fixed-function endpoints, as well as endpoint
zero (for control transfers).
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "pxa2xx_udc" and force all
gadget drivers to also be dynamically linked.
config USB_PXA2XX
tristate
depends on USB_GADGET_PXA2XX
default USB_GADGET
# if there's only one gadget driver, using only two bulk endpoints,
# don't waste memory for the other endpoints
config USB_PXA2XX_SMALL
depends on USB_GADGET_PXA2XX
bool
default y if USB_ZERO
default y if USB_ETH
default y if USB_G_SERIAL
config USB_GADGET_GOKU
boolean "Toshiba TC86C001 'Goku-S'"
depends on PCI
help
The Toshiba TC86C001 is a PCI device which includes controllers
for full speed USB devices, IDE, I2C, SIO, plus a USB host (OHCI).
The device controller has three configurable (bulk or interrupt)
endpoints, plus endpoint zero (for control transfers).
Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "goku_udc" and to force all
gadget drivers to also be dynamically linked.
config USB_GOKU
tristate
depends on USB_GADGET_GOKU
default USB_GADGET
# this could be built elsewhere (doesn't yet exist)
config USB_GADGET_SA1100
boolean "SA 1100"
depends on ARCH_SA1100
help
Intel's SA-1100 is an ARM-4 processor with an integrated
full speed USB 1.1 device controller.
It has two fixed-function endpoints, as well as endpoint
zero (for control transfers).
config USB_SA1100
tristate
depends on USB_GADGET_SA1100
default USB_GADGET
endchoice endchoice
# #
# USB Gadget Drivers # USB Gadget Drivers
# #
choice choice
prompt "USB Gadget Drivers" tristate "USB Gadget Drivers"
depends on USB_GADGET depends on USB_GADGET
default USB_ETH default USB_ETH
# FIXME want a cleaner dependency/config approach for drivers. # this first set of drivers all depend on bulk-capable hardware.
config USB_ZERO config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)" tristate "Gadget Zero (DEVELOPMENT)"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX || USB_SA1100) depends on EXPERIMENTAL
help help
Gadget Zero is a two-configuration device. It either sinks and Gadget Zero is a two-configuration device. It either sinks and
sources bulk data; or it loops back a configurable number of sources bulk data; or it loops back a configurable number of
...@@ -91,26 +162,9 @@ config USB_ZERO ...@@ -91,26 +162,9 @@ config USB_ZERO
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_zero". dynamically linked module called "g_zero".
config USB_ZERO_NET2280
bool
# for now, treat the "dummy" hcd as if it were a net2280
depends on USB_ZERO && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ZERO_PXA2XX
bool
depends on USB_ZERO && USB_PXA2XX
default y
config USB_ZERO_SA1100
bool
depends on USB_ZERO && USB_SA1100
default y
config USB_ETH config USB_ETH
tristate "Ethernet Gadget" tristate "Ethernet Gadget"
depends on USB_GADGET && NET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX || USB_SA1100) depends on NET
help help
This driver implements Ethernet style communication, in either This driver implements Ethernet style communication, in either
of two ways: of two ways:
...@@ -136,26 +190,9 @@ config USB_ETH ...@@ -136,26 +190,9 @@ config USB_ETH
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "g_ether". dynamically linked module called "g_ether".
config USB_ETH_NET2280
bool
# for now, treat the "dummy" hcd as if it were a net2280
depends on USB_ETH && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_ETH_PXA2XX
bool
depends on USB_ETH && USB_PXA2XX
default y
config USB_ETH_SA1100
bool
depends on USB_ETH && USB_SA1100
default y
config USB_GADGETFS config USB_GADGETFS
tristate "Gadget Filesystem (EXPERIMENTAL)" tristate "Gadget Filesystem (EXPERIMENTAL)"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX) && EXPERIMENTAL depends on EXPERIMENTAL
help help
This driver provides a filesystem based API that lets user mode This driver provides a filesystem based API that lets user mode
programs implement a single-configuration USB device, including programs implement a single-configuration USB device, including
...@@ -166,38 +203,44 @@ config USB_GADGETFS ...@@ -166,38 +203,44 @@ config USB_GADGETFS
Say "y" to link the driver statically, or "m" to build a Say "y" to link the driver statically, or "m" to build a
dynamically linked module called "gadgetfs". dynamically linked module called "gadgetfs".
config USB_GADGETFS_NET2280 config USB_FILE_STORAGE
bool tristate "File-backed Storage Gadget (DEVELOPMENT)"
# for now, treat the "dummy" hcd as if it were a net2280 # we don't support the SA1100 because of its limitations
depends on USB_GADGETFS && (USB_NET2280 || USB_DUMMY_HCD) depends on USB_GADGET_SA1100 = n
default y help
The File-backed Storage Gadget acts as a USB Mass Storage
disk drive. As its storage repository it can use a regular
file or a block device (in much the same way as the "loop"
device driver), specified as a module parameter.
config USB_GADGETFS_PXA2XX Say "y" to link the driver statically, or "m" to build a
bool dynamically linked module called "g_file_storage".
depends on USB_GADGETFS && USB_PXA2XX
default y config USB_FILE_STORAGE_TEST
bool "File-backed Storage Gadget test version"
depends on USB_FILE_STORAGE
default n
help
Say "y" to generate the larger testing version of the
File-backed Storage Gadget, useful for probing the
behavior of USB Mass Storage hosts. Not needed for
normal operation.
config USB_G_SERIAL config USB_G_SERIAL
tristate "serial Gadget" tristate "Serial Gadget"
depends on USB_GADGET && (USB_DUMMY_HCD || USB_NET2280 || USB_PXA2XX || USB_SA1100) help
The Serial Gadget talks to the Linux-USB generic serial driver.
config USB_G_SERIAL_NET2280 Say "y" to link the driver statically, or "m" to build a
bool dynamically linked module called "g_serial".
# for now, treat the "dummy" hcd as if it were a net2280
depends on USB_G_SERIAL && (USB_NET2280 || USB_DUMMY_HCD)
default y
config USB_G_SERIAL_PXA2XX
bool
depends on USB_G_SERIAL && USB_PXA2XX
default y
config USB_G_SERIAL_SA1100
bool
depends on USB_G_SERIAL && USB_SA1100
default y
# put drivers that need isochronous transfer support (for audio
# or video class gadget drivers), or specific hardware, here.
# - none yet
endchoice endchoice
# endmenuconfig endmenu
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# USB peripheral controller drivers # USB peripheral controller drivers
# #
obj-$(CONFIG_USB_NET2280) += net2280.o obj-$(CONFIG_USB_NET2280) += net2280.o
obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o
obj-$(CONFIG_USB_GOKU) += goku_udc.o
# #
# USB gadget drivers # USB gadget drivers
...@@ -10,8 +12,11 @@ g_zero-objs := zero.o usbstring.o ...@@ -10,8 +12,11 @@ g_zero-objs := zero.o usbstring.o
g_ether-objs := ether.o usbstring.o g_ether-objs := ether.o usbstring.o
g_serial-objs := serial.o usbstring.o g_serial-objs := serial.o usbstring.o
gadgetfs-objs := inode.o usbstring.o gadgetfs-objs := inode.o usbstring.o
g_file_storage-objs := file_storage.o usbstring.o
obj-$(CONFIG_USB_ZERO) += g_zero.o obj-$(CONFIG_USB_ZERO) += g_zero.o
obj-$(CONFIG_USB_ETH) += g_ether.o obj-$(CONFIG_USB_ETH) += g_ether.o
obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o obj-$(CONFIG_USB_GADGETFS) += gadgetfs.o
obj-$(CONFIG_USB_FILE_STORAGE) += g_file_storage.o
obj-$(CONFIG_USB_G_SERIAL) += g_serial.o obj-$(CONFIG_USB_G_SERIAL) += g_serial.o
...@@ -122,12 +122,9 @@ struct eth_dev { ...@@ -122,12 +122,9 @@ struct eth_dev {
* *
* CHIP ... hardware identifier * CHIP ... hardware identifier
* DRIVER_VERSION_NUM ... alerts the host side driver to differences * DRIVER_VERSION_NUM ... alerts the host side driver to differences
* EP0_MAXPACKET ... controls packetization of control requests
* EP_*_NAME ... which endpoints do we use for which purpose? * EP_*_NAME ... which endpoints do we use for which purpose?
* EP_*_NUM ... numbers for them (often limited by hardware) * EP_*_NUM ... numbers for them (often limited by hardware)
* HIGHSPEED ... define if ep0 and descriptors need high speed support * HIGHSPEED ... define if ep0 and descriptors need high speed support
* MAX_USB_POWER ... define if we use other than 100 mA bus current
* SELFPOWER ... unless we can run on bus power, USB_CONFIG_ATT_SELFPOWER
* WAKEUP ... if hardware supports remote wakeup AND we will issue the * WAKEUP ... if hardware supports remote wakeup AND we will issue the
* usb_gadget_wakeup() call to initiate it, USB_CONFIG_ATT_WAKEUP * usb_gadget_wakeup() call to initiate it, USB_CONFIG_ATT_WAKEUP
* *
...@@ -143,6 +140,9 @@ struct eth_dev { ...@@ -143,6 +140,9 @@ struct eth_dev {
/* #undef on hardware that can't implement CDC */ /* #undef on hardware that can't implement CDC */
#define DEV_CONFIG_CDC #define DEV_CONFIG_CDC
/* undef on bus-powered hardware, and #define MAX_USB_POWER */
#define SELFPOWER
/* /*
* NetChip 2280, PCI based. * NetChip 2280, PCI based.
* *
...@@ -152,11 +152,10 @@ struct eth_dev { ...@@ -152,11 +152,10 @@ struct eth_dev {
* performance note: only PIO needs per-usb-packet IRQs (ep0, ep-e, ep-f) * performance note: only PIO needs per-usb-packet IRQs (ep0, ep-e, ep-f)
* otherwise IRQs are per-Ethernet-packet unless TX_DELAY and chaining help. * otherwise IRQs are per-Ethernet-packet unless TX_DELAY and chaining help.
*/ */
#ifdef CONFIG_USB_ETH_NET2280 #ifdef CONFIG_USB_GADGET_NET2280
#define CHIP "net2280" #define CHIP "net2280"
#define DEFAULT_QLEN 4 /* has dma chaining */ #define DEFAULT_QLEN 4 /* has dma chaining */
#define DRIVER_VERSION_NUM 0x0101 #define DRIVER_VERSION_NUM 0x0101
#define EP0_MAXPACKET 64
static const char EP_OUT_NAME [] = "ep-a"; static const char EP_OUT_NAME [] = "ep-a";
#define EP_OUT_NUM 1 #define EP_OUT_NUM 1
static const char EP_IN_NAME [] = "ep-b"; static const char EP_IN_NAME [] = "ep-b";
...@@ -164,8 +163,6 @@ static const char EP_IN_NAME [] = "ep-b"; ...@@ -164,8 +163,6 @@ static const char EP_IN_NAME [] = "ep-b";
static const char EP_STATUS_NAME [] = "ep-f"; static const char EP_STATUS_NAME [] = "ep-f";
#define EP_STATUS_NUM 3 #define EP_STATUS_NUM 3
#define HIGHSPEED #define HIGHSPEED
/* specific hardware configs could be bus-powered */
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* supports remote wakeup, but this driver doesn't */ /* supports remote wakeup, but this driver doesn't */
extern int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode); extern int net2280_set_fifo_mode (struct usb_gadget *gadget, int mode);
...@@ -186,17 +183,14 @@ static inline void hw_optimize (struct usb_gadget *gadget) ...@@ -186,17 +183,14 @@ static inline void hw_optimize (struct usb_gadget *gadget)
* multiple interfaces (or altsettings) aren't usable. so this hardware * multiple interfaces (or altsettings) aren't usable. so this hardware
* can't implement CDC, which needs both capabilities. * can't implement CDC, which needs both capabilities.
*/ */
#ifdef CONFIG_USB_ETH_PXA2XX #ifdef CONFIG_USB_GADGET_PXA2XX
#undef DEV_CONFIG_CDC #undef DEV_CONFIG_CDC
#define CHIP "pxa2xx" #define CHIP "pxa2xx"
#define DRIVER_VERSION_NUM 0x0103 #define DRIVER_VERSION_NUM 0x0103
#define EP0_MAXPACKET 16
static const char EP_OUT_NAME [] = "ep2out-bulk"; static const char EP_OUT_NAME [] = "ep2out-bulk";
#define EP_OUT_NUM 2 #define EP_OUT_NUM 2
static const char EP_IN_NAME [] = "ep1in-bulk"; static const char EP_IN_NAME [] = "ep1in-bulk";
#define EP_IN_NUM 1 #define EP_IN_NUM 1
/* doesn't support bus-powered operation */
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* supports remote wakeup, but this driver doesn't */ /* supports remote wakeup, but this driver doesn't */
/* no hw optimizations to apply */ /* no hw optimizations to apply */
...@@ -209,17 +203,14 @@ static const char EP_IN_NAME [] = "ep1in-bulk"; ...@@ -209,17 +203,14 @@ static const char EP_IN_NAME [] = "ep1in-bulk";
* can't have a notification endpoint, since there are only the two * can't have a notification endpoint, since there are only the two
* bulk-capable ones. the CDC spec allows that. * bulk-capable ones. the CDC spec allows that.
*/ */
#ifdef CONFIG_USB_ETH_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
#define CHIP "sa1100" #define CHIP "sa1100"
#define DRIVER_VERSION_NUM 0x0105 #define DRIVER_VERSION_NUM 0x0105
#define EP0_MAXPACKET 8
static const char EP_OUT_NAME [] = "ep1out-bulk"; static const char EP_OUT_NAME [] = "ep1out-bulk";
#define EP_OUT_NUM 1 #define EP_OUT_NUM 1
static const char EP_IN_NAME [] = "ep2in-bulk"; static const char EP_IN_NAME [] = "ep2in-bulk";
#define EP_IN_NUM 2 #define EP_IN_NUM 2
// EP_STATUS_NUM is undefined // EP_STATUS_NUM is undefined
/* doesn't support bus-powered operation */
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* doesn't support remote wakeup? */ /* doesn't support remote wakeup? */
/* no hw optimizations to apply */ /* no hw optimizations to apply */
...@@ -231,25 +222,43 @@ static const char EP_IN_NAME [] = "ep2in-bulk"; ...@@ -231,25 +222,43 @@ static const char EP_IN_NAME [] = "ep2in-bulk";
* *
* This has three semi-configurable full speed bulk/interrupt endpoints. * This has three semi-configurable full speed bulk/interrupt endpoints.
*/ */
#ifdef CONFIG_USB_ETH_GOKU #ifdef CONFIG_USB_GADGET_GOKU
#define CHIP "goku" #define CHIP "goku"
#define DRIVER_VERSION_NUM 0x0106 #define DRIVER_VERSION_NUM 0x0106
#define EP0_MAXPACKET 8
static const char EP_OUT_NAME [] = "ep1-bulk"; static const char EP_OUT_NAME [] = "ep1-bulk";
#define EP_OUT_NUM 1 #define EP_OUT_NUM 1
static const char EP_IN_NAME [] = "ep2-bulk"; static const char EP_IN_NAME [] = "ep2-bulk";
#define EP_IN_NUM 2 #define EP_IN_NUM 2
static const char EP_STATUS_NAME [] = "ep3-bulk"; static const char EP_STATUS_NAME [] = "ep3-bulk";
#define EP_STATUS_NUM 3 #define EP_STATUS_NUM 3
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* doesn't support remote wakeup */ /* doesn't support remote wakeup */
#define hw_optimize(g) do {} while (0) #define hw_optimize(g) do {} while (0)
#endif #endif
/*
* SuperH UDC: UDC built-in to some Renesas SH processors.
*
* This has three semi-configurable full speed bulk/interrupt endpoints.
*
* Only one configuration and interface is supported. So this hardware
* can't implement CDC.
*/
#ifdef CONFIG_USB_GADGET_SUPERH
#undef DEV_CONFIG_CDC
#define CHIP "superh"
#define DRIVER_VERSION_NUM 0x0107
static const char EP_OUT_NAME[] = "ep1out-bulk";
#define EP_OUT_NUM 1
static const char EP_IN_NAME[] = "ep2in-bulk";
#define EP_IN_NUM 2
#define hw_optimize(g) do {} while (0)
#endif
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifndef EP0_MAXPACKET #ifndef CHIP
# error Configure some USB peripheral controller driver! # error Configure some USB peripheral controller driver!
#endif #endif
...@@ -280,19 +289,15 @@ static const char EP_STATUS_NAME [] = "ep3-bulk"; ...@@ -280,19 +289,15 @@ static const char EP_STATUS_NAME [] = "ep3-bulk";
* hardware that supports remote wakeup defaults to disabling it. * hardware that supports remote wakeup defaults to disabling it.
*/ */
#ifndef SELFPOWER
/* default: say we rely on bus power */
#define SELFPOWER 0
/* else:
* - SELFPOWER value must be USB_CONFIG_ATT_SELFPOWER
* - MAX_USB_POWER may be nonzero.
*/
#endif
#ifndef MAX_USB_POWER #ifndef MAX_USB_POWER
/* any hub supports this steady state bus power consumption */ #ifdef SELFPOWER
#define MAX_USB_POWER 100 /* mA */ /* some hosts are confused by 0mA */
#define MAX_USB_POWER 2 /* mA */
#else
/* bus powered */
#error Define your bus power consumption!
#endif #endif
#endif /* MAX_USB_POWER */
#ifndef WAKEUP #ifndef WAKEUP
/* default: this driver won't do remote wakeup */ /* default: this driver won't do remote wakeup */
...@@ -376,7 +381,7 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR); ...@@ -376,7 +381,7 @@ module_param (qmult, uint, S_IRUGO|S_IWUSR);
/* /*
* This device advertises one configuration. * This device advertises one configuration.
*/ */
static const struct usb_device_descriptor static struct usb_device_descriptor
device_desc = { device_desc = {
.bLength = sizeof device_desc, .bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE, .bDescriptorType = USB_DT_DEVICE,
...@@ -386,7 +391,6 @@ device_desc = { ...@@ -386,7 +391,6 @@ device_desc = {
.bDeviceClass = DEV_CONFIG_CLASS, .bDeviceClass = DEV_CONFIG_CLASS,
.bDeviceSubClass = 0, .bDeviceSubClass = 0,
.bDeviceProtocol = 0, .bDeviceProtocol = 0,
.bMaxPacketSize0 = EP0_MAXPACKET,
.idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM), .idVendor = __constant_cpu_to_le16 (DRIVER_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM), .idProduct = __constant_cpu_to_le16 (DRIVER_PRODUCT_NUM),
...@@ -396,7 +400,7 @@ device_desc = { ...@@ -396,7 +400,7 @@ device_desc = {
.bNumConfigurations = 1, .bNumConfigurations = 1,
}; };
static const struct usb_config_descriptor static struct usb_config_descriptor
eth_config = { eth_config = {
.bLength = sizeof eth_config, .bLength = sizeof eth_config,
.bDescriptorType = USB_DT_CONFIG, .bDescriptorType = USB_DT_CONFIG,
...@@ -409,7 +413,7 @@ eth_config = { ...@@ -409,7 +413,7 @@ eth_config = {
#endif #endif
.bConfigurationValue = DEV_CONFIG_VALUE, .bConfigurationValue = DEV_CONFIG_VALUE,
.iConfiguration = STRING_PRODUCT, .iConfiguration = STRING_PRODUCT,
.bmAttributes = USB_CONFIG_ATT_ONE | SELFPOWER | WAKEUP, .bmAttributes = USB_CONFIG_ATT_ONE | WAKEUP,
.bMaxPower = (MAX_USB_POWER + 1) / 2, .bMaxPower = (MAX_USB_POWER + 1) / 2,
}; };
...@@ -645,7 +649,7 @@ hs_sink_desc = { ...@@ -645,7 +649,7 @@ hs_sink_desc = {
.bInterval = 1, .bInterval = 1,
}; };
static const struct usb_qualifier_descriptor static struct usb_qualifier_descriptor
dev_qualifier = { dev_qualifier = {
.bLength = sizeof dev_qualifier, .bLength = sizeof dev_qualifier,
.bDescriptorType = USB_DT_DEVICE_QUALIFIER, .bDescriptorType = USB_DT_DEVICE_QUALIFIER,
...@@ -653,12 +657,10 @@ dev_qualifier = { ...@@ -653,12 +657,10 @@ dev_qualifier = {
.bcdUSB = __constant_cpu_to_le16 (0x0200), .bcdUSB = __constant_cpu_to_le16 (0x0200),
.bDeviceClass = DEV_CONFIG_CLASS, .bDeviceClass = DEV_CONFIG_CLASS,
/* assumes ep0 uses the same value for both speeds ... */
.bMaxPacketSize0 = EP0_MAXPACKET,
.bNumConfigurations = 1, .bNumConfigurations = 1,
}; };
/* maxpacket and other transfer characteristics vary by speed. */ /* maxpacket and other transfer characteristics vary by speed. */
#define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs)) #define ep_desc(g,hs,fs) (((g)->speed==USB_SPEED_HIGH)?(hs):(fs))
...@@ -959,7 +961,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags) ...@@ -959,7 +961,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags)
if (number == dev->config) if (number == dev->config)
return 0; return 0;
#ifdef CONFIG_USB_ETH_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
if (dev->config && atomic_read (&dev->tx_qlen) != 0) { if (dev->config && atomic_read (&dev->tx_qlen) != 0) {
/* tx fifo is full, but we can't clear it...*/ /* tx fifo is full, but we can't clear it...*/
INFO (dev, "can't change configurations\n"); INFO (dev, "can't change configurations\n");
...@@ -1006,6 +1008,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags) ...@@ -1006,6 +1008,7 @@ eth_set_config (struct eth_dev *dev, unsigned number, int gfp_flags)
/* section 3.8.2 table 11 of the CDC spec lists Ethernet notifications */ /* section 3.8.2 table 11 of the CDC spec lists Ethernet notifications */
#define CDC_NOTIFY_NETWORK_CONNECTION 0x00 /* required; 6.3.1 */ #define CDC_NOTIFY_NETWORK_CONNECTION 0x00 /* required; 6.3.1 */
#define CDC_NOTIFY_RESPONSE_AVAILABLE 0x01 /* optional; 6.3.2 */
#define CDC_NOTIFY_SPEED_CHANGE 0x2a /* required; 6.3.8 */ #define CDC_NOTIFY_SPEED_CHANGE 0x2a /* required; 6.3.8 */
struct cdc_notification { struct cdc_notification {
...@@ -1123,6 +1126,8 @@ static void eth_setup_complete (struct usb_ep *ep, struct usb_request *req) ...@@ -1123,6 +1126,8 @@ static void eth_setup_complete (struct usb_ep *ep, struct usb_request *req)
/* see section 3.8.2 table 10 of the CDC spec for more ethernet /* see section 3.8.2 table 10 of the CDC spec for more ethernet
* requests, mostly for filters (multicast, pm) and statistics * requests, mostly for filters (multicast, pm) and statistics
*/ */
#define CDC_SEND_ENCAPSULATED_REQUEST 0x00 /* optional */
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01 /* optional */
#define CDC_SET_ETHERNET_PACKET_FILTER 0x43 /* required */ #define CDC_SET_ETHERNET_PACKET_FILTER 0x43 /* required */
/* /*
...@@ -1188,7 +1193,7 @@ eth_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) ...@@ -1188,7 +1193,7 @@ eth_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
value = eth_set_config (dev, ctrl->wValue, GFP_ATOMIC); value = eth_set_config (dev, ctrl->wValue, GFP_ATOMIC);
spin_unlock (&dev->lock); spin_unlock (&dev->lock);
break; break;
#ifdef CONFIG_USB_ETH_PXA2XX #ifdef CONFIG_USB_GADGET_PXA2XX
/* PXA UDC prevents us from using SET_INTERFACE in normal ways. /* PXA UDC prevents us from using SET_INTERFACE in normal ways.
* And it hides GET_CONFIGURATION and GET_INTERFACE too. * And it hides GET_CONFIGURATION and GET_INTERFACE too.
*/ */
...@@ -1638,7 +1643,7 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -1638,7 +1643,7 @@ static int eth_start_xmit (struct sk_buff *skb, struct net_device *net)
req->context = skb; req->context = skb;
req->complete = tx_complete; req->complete = tx_complete;
#ifdef CONFIG_USB_ETH_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
/* don't demand zlp (req->zero) support from all hardware */ /* don't demand zlp (req->zero) support from all hardware */
if ((length % dev->in_ep->maxpacket) == 0) if ((length % dev->in_ep->maxpacket) == 0)
length++; length++;
...@@ -1770,6 +1775,17 @@ eth_bind (struct usb_gadget *gadget) ...@@ -1770,6 +1775,17 @@ eth_bind (struct usb_gadget *gadget)
return -ENODEV; return -ENODEV;
#endif #endif
device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
#ifdef HIGHSPEED
/* assumes ep0 uses the same value for both speeds ... */
dev_qualifier.bMaxPacketSize0 = device_desc.bMaxPacketSize0;
#endif
#ifdef SELFPOWERED
eth_config.bmAttributes |= USB_CONFIG_ATT_SELFPOWERED;
usb_gadget_set_selfpowered (gadget);
#endif
net = alloc_etherdev (sizeof *dev); net = alloc_etherdev (sizeof *dev);
if (!net) if (!net)
return status; return status;
......
This diff is collapsed.
...@@ -232,18 +232,27 @@ static void put_ep (struct ep_data *data) ...@@ -232,18 +232,27 @@ static void put_ep (struct ep_data *data)
* the usb controller exposes. * the usb controller exposes.
*/ */
#ifdef CONFIG_USB_GADGETFS_NET2280 #ifdef CONFIG_USB_GADGET_DUMMY_HCD
/* act (mostly) like a net2280 */
#define CONFIG_USB_GADGET_NET2280
#endif
#ifdef CONFIG_USB_GADGET_NET2280
#define CHIP "net2280" #define CHIP "net2280"
#define HIGHSPEED #define HIGHSPEED
#endif #endif
#ifdef CONFIG_USB_GADGETFS_PXA2XX #ifdef CONFIG_USB_GADGET_PXA2XX
#define CHIP "pxa2xx_udc" #define CHIP "pxa2xx_udc"
/* earlier hardware doesn't have UDCCFR, races set_{config,interface} */ /* earlier hardware doesn't have UDCCFR, races set_{config,interface} */
#warning works best with pxa255 or newer #warning works best with pxa255 or newer
#endif #endif
#ifdef CONFIG_USB_GADGETFS_SA1100 #ifdef CONFIG_USB_GADGET_GOKU
#define CHIP "goku_udc"
#endif
#ifdef CONFIG_USB_GADGET_SA1100
#define CHIP "sa1100" #define CHIP "sa1100"
#endif #endif
...@@ -397,7 +406,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len) ...@@ -397,7 +406,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)
/* handle a synchronous OUT bulk/intr/iso transfer */ /* handle a synchronous OUT bulk/intr/iso transfer */
static ssize_t static ssize_t
ep_read (struct file *fd, char *buf, size_t len, loff_t *ptr) ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr)
{ {
struct ep_data *data = fd->private_data; struct ep_data *data = fd->private_data;
void *kbuf; void *kbuf;
...@@ -441,7 +450,7 @@ ep_read (struct file *fd, char *buf, size_t len, loff_t *ptr) ...@@ -441,7 +450,7 @@ ep_read (struct file *fd, char *buf, size_t len, loff_t *ptr)
/* handle a synchronous IN bulk/intr/iso transfer */ /* handle a synchronous IN bulk/intr/iso transfer */
static ssize_t static ssize_t
ep_write (struct file *fd, const char *buf, size_t len, loff_t *ptr) ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
{ {
struct ep_data *data = fd->private_data; struct ep_data *data = fd->private_data;
void *kbuf; void *kbuf;
......
This diff is collapsed.
...@@ -520,6 +520,7 @@ struct net2280_ep { ...@@ -520,6 +520,7 @@ struct net2280_ep {
unsigned num : 8, unsigned num : 8,
fifo_size : 12, fifo_size : 12,
in_fifo_validate : 1, in_fifo_validate : 1,
out_overflow : 1,
stopped : 1, stopped : 1,
is_in : 1, is_in : 1,
is_iso : 1; is_iso : 1;
...@@ -529,6 +530,7 @@ static inline void allow_status (struct net2280_ep *ep) ...@@ -529,6 +530,7 @@ static inline void allow_status (struct net2280_ep *ep)
{ {
/* ep0 only */ /* ep0 only */
writel ( (1 << CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE) writel ( (1 << CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE)
| (1 << CLEAR_NAK_OUT_PACKETS)
| (1 << CLEAR_NAK_OUT_PACKETS_MODE) | (1 << CLEAR_NAK_OUT_PACKETS_MODE)
, &ep->regs->ep_rsp); , &ep->regs->ep_rsp);
ep->stopped = 1; ep->stopped = 1;
...@@ -546,7 +548,6 @@ struct net2280_request { ...@@ -546,7 +548,6 @@ struct net2280_request {
dma_addr_t td_dma; dma_addr_t td_dma;
struct list_head queue; struct list_head queue;
unsigned mapped : 1, unsigned mapped : 1,
dma_done : 1,
valid : 1; valid : 1;
}; };
...@@ -559,8 +560,7 @@ struct net2280 { ...@@ -559,8 +560,7 @@ struct net2280 {
unsigned enabled : 1, unsigned enabled : 1,
protocol_stall : 1, protocol_stall : 1,
got_irq : 1, got_irq : 1,
region : 1, region : 1;
selfpowered : 1;
u16 chiprev; u16 chiprev;
/* pci state used to access those endpoints */ /* pci state used to access those endpoints */
......
...@@ -135,9 +135,6 @@ do { \ ...@@ -135,9 +135,6 @@ do { \
#define GS_NUM_PORTS 16 #define GS_NUM_PORTS 16
#define GS_VENDOR_ID 0x05F9
#define GS_PRODUCT_ID 0xFFFF
#define GS_NUM_CONFIGS 1 #define GS_NUM_CONFIGS 1
#define GS_NO_CONFIG_ID 0 #define GS_NO_CONFIG_ID 0
#define GS_BULK_CONFIG_ID 2 #define GS_BULK_CONFIG_ID 2
...@@ -187,7 +184,7 @@ static int debug = G_SERIAL_DEBUG; ...@@ -187,7 +184,7 @@ static int debug = G_SERIAL_DEBUG;
* DMA channels to manage their FIFOs. It supports high speed. * DMA channels to manage their FIFOs. It supports high speed.
* Those endpoints can be arranged in any desired configuration. * Those endpoints can be arranged in any desired configuration.
*/ */
#ifdef CONFIG_USB_G_SERIAL_NET2280 #ifdef CONFIG_USB_GADGET_NET2280
#define CHIP "net2280" #define CHIP "net2280"
#define EP0_MAXPACKET 64 #define EP0_MAXPACKET 64
static const char EP_OUT_NAME[] = "ep-a"; static const char EP_OUT_NAME[] = "ep-a";
...@@ -220,13 +217,13 @@ static inline void hw_optimize(struct usb_gadget *gadget) ...@@ -220,13 +217,13 @@ static inline void hw_optimize(struct usb_gadget *gadget)
* can't use altsettings or reset the interfaces independently. * can't use altsettings or reset the interfaces independently.
* So stick to a single interface. * So stick to a single interface.
*/ */
#ifdef CONFIG_USB_G_SERIAL_PXA2XX #ifdef CONFIG_USB_GADGET_PXA2XX
#define CHIP "pxa2xx" #define CHIP "pxa2xx"
#define EP0_MAXPACKET 16 #define EP0_MAXPACKET 16
static const char EP_OUT_NAME[] = "ep12out-bulk"; static const char EP_OUT_NAME[] = "ep2out-bulk";
#define EP_OUT_NUM 12 #define EP_OUT_NUM 2
static const char EP_IN_NAME[] = "ep11in-bulk"; static const char EP_IN_NAME[] = "ep1in-bulk";
#define EP_IN_NUM 11 #define EP_IN_NUM 1
#define SELFPOWER USB_CONFIG_ATT_SELFPOWER #define SELFPOWER USB_CONFIG_ATT_SELFPOWER
/* no hw optimizations to apply */ /* no hw optimizations to apply */
...@@ -245,7 +242,7 @@ static const char EP_IN_NAME[] = "ep11in-bulk"; ...@@ -245,7 +242,7 @@ static const char EP_IN_NAME[] = "ep11in-bulk";
* in special situations. So this is a case of "choose it right * in special situations. So this is a case of "choose it right
* during enumeration" ... * during enumeration" ...
*/ */
#ifdef CONFIG_USB_G_SERIAL_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
#define CHIP "sa1100" #define CHIP "sa1100"
#define EP0_MAXPACKET 8 #define EP0_MAXPACKET 8
static const char EP_OUT_NAME[] = "ep1out-bulk"; static const char EP_OUT_NAME[] = "ep1out-bulk";
...@@ -264,7 +261,7 @@ static const char EP_IN_NAME [] = "ep2in-bulk"; ...@@ -264,7 +261,7 @@ static const char EP_IN_NAME [] = "ep2in-bulk";
* *
* This has three semi-configurable full speed bulk/interrupt endpoints. * This has three semi-configurable full speed bulk/interrupt endpoints.
*/ */
#ifdef CONFIG_USB_G_SERIAL_GOKU #ifdef CONFIG_USB_GADGET_GOKU
#define CHIP "goku" #define CHIP "goku"
#define DRIVER_VERSION_NUM 0x0116 #define DRIVER_VERSION_NUM 0x0116
#define EP0_MAXPACKET 8 #define EP0_MAXPACKET 8
...@@ -302,6 +299,14 @@ static const char EP_IN_NAME [] = "ep2-bulk"; ...@@ -302,6 +299,14 @@ static const char EP_IN_NAME [] = "ep2-bulk";
/* else value must be USB_CONFIG_ATT_WAKEUP */ /* else value must be USB_CONFIG_ATT_WAKEUP */
#endif #endif
/* Thanks to NetChip Technologies for donating this product ID.
*
* DO NOT REUSE THESE IDs with a protocol-incompatible driver!! Ever!!
* Instead: allocate your own, using normal USB-IF procedures.
*/
#define GS_VENDOR_ID 0x0525 /* NetChip */
#define GS_PRODUCT_ID 0xa4a6 /* Linux-USB Serial Gadget */
/* Structures */ /* Structures */
......
...@@ -131,7 +131,7 @@ static const char loopback [] = "loop input to output"; ...@@ -131,7 +131,7 @@ static const char loopback [] = "loop input to output";
* DMA channels to manage their FIFOs. It supports high speed. * DMA channels to manage their FIFOs. It supports high speed.
* Those endpoints can be arranged in any desired configuration. * Those endpoints can be arranged in any desired configuration.
*/ */
#ifdef CONFIG_USB_ZERO_NET2280 #if defined(CONFIG_USB_GADGET_NET2280) || defined(CONFIG_USB_GADGET_DUMMY_HCD)
#define CHIP "net2280" #define CHIP "net2280"
#define DRIVER_VERSION_NUM 0x0101 #define DRIVER_VERSION_NUM 0x0101
static const char EP_OUT_NAME [] = "ep-a"; static const char EP_OUT_NAME [] = "ep-a";
...@@ -154,7 +154,7 @@ static const char EP_IN_NAME [] = "ep-b"; ...@@ -154,7 +154,7 @@ static const char EP_IN_NAME [] = "ep-b";
* can't use altsettings or reset the interfaces independently. * can't use altsettings or reset the interfaces independently.
* So stick to a single interface. * So stick to a single interface.
*/ */
#ifdef CONFIG_USB_ZERO_PXA2XX #ifdef CONFIG_USB_GADGET_PXA2XX
#define CHIP "pxa2xx" #define CHIP "pxa2xx"
#define DRIVER_VERSION_NUM 0x0103 #define DRIVER_VERSION_NUM 0x0103
static const char EP_OUT_NAME [] = "ep12out-bulk"; static const char EP_OUT_NAME [] = "ep12out-bulk";
...@@ -176,7 +176,7 @@ static const char EP_IN_NAME [] = "ep11in-bulk"; ...@@ -176,7 +176,7 @@ static const char EP_IN_NAME [] = "ep11in-bulk";
* in special situations. So this is a case of "choose it right * in special situations. So this is a case of "choose it right
* during enumeration" ... * during enumeration" ...
*/ */
#ifdef CONFIG_USB_ZERO_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
#define CHIP "sa1100" #define CHIP "sa1100"
#define DRIVER_VERSION_NUM 0x0105 #define DRIVER_VERSION_NUM 0x0105
static const char EP_OUT_NAME [] = "ep1out-bulk"; static const char EP_OUT_NAME [] = "ep1out-bulk";
...@@ -192,7 +192,7 @@ static const char EP_IN_NAME [] = "ep2in-bulk"; ...@@ -192,7 +192,7 @@ static const char EP_IN_NAME [] = "ep2in-bulk";
* *
* This has three semi-configurable full speed bulk/interrupt endpoints. * This has three semi-configurable full speed bulk/interrupt endpoints.
*/ */
#ifdef CONFIG_USB_ZERO_GOKU #ifdef CONFIG_USB_GADGET_GOKU
#define CHIP "goku" #define CHIP "goku"
#define DRIVER_VERSION_NUM 0x0106 #define DRIVER_VERSION_NUM 0x0106
static const char EP_OUT_NAME [] = "ep1-bulk"; static const char EP_OUT_NAME [] = "ep1-bulk";
...@@ -936,7 +936,7 @@ zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags) ...@@ -936,7 +936,7 @@ zero_set_config (struct zero_dev *dev, unsigned number, int gfp_flags)
if (number == dev->config) if (number == dev->config)
return 0; return 0;
#ifdef CONFIG_USB_ZERO_SA1100 #ifdef CONFIG_USB_GADGET_SA1100
if (dev->config) { if (dev->config) {
/* tx fifo is full, but we can't clear it...*/ /* tx fifo is full, but we can't clear it...*/
INFO (dev, "can't change configurations\n"); INFO (dev, "can't change configurations\n");
......
...@@ -684,6 +684,10 @@ MODULE_LICENSE ("GPL"); ...@@ -684,6 +684,10 @@ MODULE_LICENSE ("GPL");
#include "ohci-sa1111.c" #include "ohci-sa1111.c"
#endif #endif
#if !(defined(CONFIG_PCI) || defined(CONFIG_SA1111)) #ifdef CONFIG_ARCH_OMAP
#include "ohci-omap.c"
#endif
#if !(defined(CONFIG_PCI) || defined(CONFIG_SA1111) || defined(CONFIG_ARCH_OMAP))
#error "missing bus glue for ohci-hcd" #error "missing bus glue for ohci-hcd"
#endif #endif
This diff is collapsed.
/*
* linux/drivers/usb/host/ohci-omap.h
*
* OMAP OHCI USB controller specific defines
*/
/* OMAP USB OHCI common defines */
#define OMAP_OHCI_NAME "omap-ohci"
#define OMAP_OHCI_BASE 0xfffba000
#define OMAP_OHCI_SIZE 4096
#define HMC_CLEAR (0x3f << 1)
#define APLL_NDPLL_SWITCH 0x0001
#define DPLL_PLL_ENABLE 0x0010
#define DPLL_LOCK 0x0001
#define SOFT_REQ_REG_REQ 0x0001
#define USB_MCLK_EN 0x0010
#define USB_HOST_HHC_UHOST_EN 0x00000200
#define SOFT_USB_OTG_REQ (1 << 8)
#define SOFT_USB_REQ (1 << 3)
#define STATUS_REQ_REG 0xfffe0840
#define USB_HOST_DPLL_REQ (1 << 8)
#define SOFT_DPLL_REQ (1 << 0)
/* OMAP-1510 USB OHCI defines */
#define OMAP1510_LB_MEMSIZE 32 /* Should be same as SDRAM size */
#define OMAP1510_LB_CLOCK_DIV 0xfffec10c
#define OMAP1510_LB_MMU_CTL 0xfffec208
#define OMAP1510_LB_MMU_LCK 0xfffec224
#define OMAP1510_LB_MMU_LD_TLB 0xfffec228
#define OMAP1510_LB_MMU_CAM_H 0xfffec22c
#define OMAP1510_LB_MMU_CAM_L 0xfffec230
#define OMAP1510_LB_MMU_RAM_H 0xfffec234
#define OMAP1510_LB_MMU_RAM_L 0xfffec238
/* OMAP-1610 USB OHCI defines */
#define USB_TRANSCEIVER_CTRL 0xfffe1064
#define OTG_REV 0xfffb0400
#define OTG_SYSCON_1 0xfffb0404
#define OTG_IDLE_EN (1 << 15)
#define DEV_IDLE_EN (1 << 13)
#define OTG_SYSCON_2 0xfffb0408
#define OTG_CTRL 0xfffb040c
#define OTG_IRQ_EN 0xfffb0410
#define OTG_IRQ_SRC 0xfffb0414
#define OTG_EN (1 << 31)
#define USBX_SYNCHRO (1 << 30)
#define SRP_VBUS (1 << 12)
#define OTG_PADEN (1 << 10)
#define HMC_PADEN (1 << 9)
#define UHOST_EN (1 << 8)
/* Hardware specific defines */
#define OMAP1510_FPGA_HOST_CTRL 0xe800020c
...@@ -781,17 +781,25 @@ static int dabusb_probe (struct usb_interface *intf, ...@@ -781,17 +781,25 @@ static int dabusb_probe (struct usb_interface *intf,
static void dabusb_disconnect (struct usb_interface *intf) static void dabusb_disconnect (struct usb_interface *intf)
{ {
wait_queue_t __wait;
pdabusb_t s = usb_get_intfdata (intf); pdabusb_t s = usb_get_intfdata (intf);
dbg("dabusb_disconnect"); dbg("dabusb_disconnect");
init_waitqueue_entry(&__wait, current);
usb_set_intfdata (intf, NULL); usb_set_intfdata (intf, NULL);
if (s) { if (s) {
usb_deregister_dev (intf, &dabusb_class); usb_deregister_dev (intf, &dabusb_class);
s->remove_pending = 1; s->remove_pending = 1;
wake_up (&s->wait); wake_up (&s->wait);
add_wait_queue(&s->remove_ok, &__wait);
set_current_state(TASK_UNINTERRUPTIBLE);
if (s->state == _started) if (s->state == _started)
sleep_on (&s->remove_ok); schedule();
current->state = TASK_RUNNING;
remove_wait_queue(&s->remove_ok, &__wait);
s->usbdev = NULL; s->usbdev = NULL;
s->overruns = 0; s->overruns = 0;
} }
......
...@@ -6,6 +6,7 @@ comment "USB Miscellaneous drivers" ...@@ -6,6 +6,7 @@ comment "USB Miscellaneous drivers"
config USB_EMI62 config USB_EMI62
tristate "EMI 6|2m USB Audio interface support" tristate "EMI 6|2m USB Audio interface support"
depends on USB
---help--- ---help---
This driver loads firmware to Emagic EMI 6|2m low latency USB This driver loads firmware to Emagic EMI 6|2m low latency USB
Audio and Midi interface. Audio and Midi interface.
...@@ -20,6 +21,7 @@ config USB_EMI62 ...@@ -20,6 +21,7 @@ config USB_EMI62
config USB_EMI26 config USB_EMI26
tristate "EMI 2|6 USB Audio interface support" tristate "EMI 2|6 USB Audio interface support"
depends on USB
---help--- ---help---
This driver loads firmware to Emagic EMI 2|6 low latency USB This driver loads firmware to Emagic EMI 2|6 low latency USB
Audio interface. Audio interface.
......
...@@ -1927,7 +1927,6 @@ static int auerswald_probe (struct usb_interface *intf, ...@@ -1927,7 +1927,6 @@ static int auerswald_probe (struct usb_interface *intf,
{ {
struct usb_device *usbdev = interface_to_usbdev(intf); struct usb_device *usbdev = interface_to_usbdev(intf);
pauerswald_t cp = NULL; pauerswald_t cp = NULL;
DECLARE_WAIT_QUEUE_HEAD (wqh);
unsigned int u = 0; unsigned int u = 0;
char *pbuf; char *pbuf;
int ret; int ret;
...@@ -1975,7 +1974,8 @@ static int auerswald_probe (struct usb_interface *intf, ...@@ -1975,7 +1974,8 @@ static int auerswald_probe (struct usb_interface *intf,
dbg ("Version is %X", cp->version); dbg ("Version is %X", cp->version);
/* allow some time to settle the device */ /* allow some time to settle the device */
sleep_on_timeout (&wqh, HZ / 3 ); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/3);
/* Try to get a suitable textual description of the device */ /* Try to get a suitable textual description of the device */
/* Device name:*/ /* Device name:*/
......
...@@ -161,7 +161,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos) ...@@ -161,7 +161,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
int bytes_to_read = 0; int bytes_to_read = 0;
int bytes_read = 0; int bytes_read = 0;
int result = 0; int result = 0;
char buffer[BULK_RCV_MAX]; char *buffer;
unsigned int pipe; unsigned int pipe;
if (*f_pos) if (*f_pos)
...@@ -173,6 +173,10 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos) ...@@ -173,6 +173,10 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
if (!s->dev) if (!s->dev)
return -EIO; return -EIO;
buffer = kmalloc(BULK_RCV_MAX, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
bytes_to_read = (count >= BULK_RCV_MAX) ? BULK_RCV_MAX : count; bytes_to_read = (count >= BULK_RCV_MAX) ? BULK_RCV_MAX : count;
pipe = usb_rcvbulkpipe (s->dev, 1); pipe = usb_rcvbulkpipe (s->dev, 1);
...@@ -203,6 +207,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos) ...@@ -203,6 +207,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
} }
out: out:
kfree(buffer);
return ret ? ret : bytes_read; return ret ? ret : bytes_read;
} }
...@@ -214,7 +219,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t * ...@@ -214,7 +219,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
int bytes_to_write = 0; int bytes_to_write = 0;
int bytes_written = 0; int bytes_written = 0;
int result = 0; int result = 0;
char buffer[BULK_SND_MAX]; char *buffer;
unsigned int pipe; unsigned int pipe;
if (*f_pos) if (*f_pos)
...@@ -226,6 +231,10 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t * ...@@ -226,6 +231,10 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
if (!s->dev) if (!s->dev)
return -EIO; return -EIO;
buffer = kmalloc(BULK_SND_MAX, GFP_KERNEL);
if (!buffer)
return -ENOMEM;
bytes_to_write = (count >= BULK_SND_MAX) ? BULK_SND_MAX : count; bytes_to_write = (count >= BULK_SND_MAX) ? BULK_SND_MAX : count;
if (copy_from_user (buffer, buf, bytes_to_write)) { if (copy_from_user (buffer, buf, bytes_to_write)) {
ret = -EFAULT; ret = -EFAULT;
...@@ -258,6 +267,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t * ...@@ -258,6 +267,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
} }
out: out:
kfree(buffer);
return ret ? ret : bytes_written; return ret ? ret : bytes_written;
} }
...@@ -387,7 +397,11 @@ tiglusb_probe (struct usb_interface *intf, ...@@ -387,7 +397,11 @@ tiglusb_probe (struct usb_interface *intf,
static void static void
tiglusb_disconnect (struct usb_interface *intf) tiglusb_disconnect (struct usb_interface *intf)
{ {
wait_queue_t __wait;
ptiglusb_t s = usb_get_intfdata (intf); ptiglusb_t s = usb_get_intfdata (intf);
init_waitqueue_entry(&__wait, current);
usb_set_intfdata (intf, NULL); usb_set_intfdata (intf, NULL);
if (!s || !s->dev) { if (!s || !s->dev) {
...@@ -397,8 +411,12 @@ tiglusb_disconnect (struct usb_interface *intf) ...@@ -397,8 +411,12 @@ tiglusb_disconnect (struct usb_interface *intf)
s->remove_pending = 1; s->remove_pending = 1;
wake_up (&s->wait); wake_up (&s->wait);
add_wait_queue(&s->wait, &__wait);
set_current_state(TASK_UNINTERRUPTIBLE);
if (s->state == _started) if (s->state == _started)
sleep_on (&s->remove_ok); schedule();
current->state = TASK_RUNNING;
remove_wait_queue(&s->wait, &__wait);
down (&s->mutex); down (&s->mutex);
s->dev = NULL; s->dev = NULL;
s->opened = 0; s->opened = 0;
......
...@@ -651,7 +651,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file, ...@@ -651,7 +651,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
return 0; return 0;
case TCSETS: // 0x5402 case TCSETS: // 0x5402
if (! &port->tty->termios) { if (!(port->tty->termios)) {
dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number); dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number);
return -ENOTTY; return -ENOTTY;
} }
......
...@@ -353,8 +353,8 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -353,8 +353,8 @@ static int whiteheat_attach (struct usb_serial *serial)
int pipe; int pipe;
int ret; int ret;
int alen; int alen;
__u8 command[2] = { WHITEHEAT_GET_HW_INFO, 0 }; __u8 *command;
__u8 result[sizeof(*hw_info) + 1]; __u8 *result;
int i; int i;
int j; int j;
struct urb *urb; struct urb *urb;
...@@ -365,13 +365,22 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -365,13 +365,22 @@ static int whiteheat_attach (struct usb_serial *serial)
command_port = serial->port[COMMAND_PORT]; command_port = serial->port[COMMAND_PORT];
pipe = usb_sndbulkpipe (serial->dev, command_port->bulk_out_endpointAddress); pipe = usb_sndbulkpipe (serial->dev, command_port->bulk_out_endpointAddress);
command = kmalloc(2, GFP_KERNEL);
if (!command)
goto no_command_buffer;
command[0] = WHITEHEAT_GET_HW_INFO;
command[1] = 0;
result = kmalloc(sizeof(*hw_info) + 1, GFP_KERNEL);
if (!result)
goto no_result_buffer;
/* /*
* When the module is reloaded the firmware is still there and * When the module is reloaded the firmware is still there and
* the endpoints are still in the usb core unchanged. This is the * the endpoints are still in the usb core unchanged. This is the
* unlinking bug in disguise. Same for the call below. * unlinking bug in disguise. Same for the call below.
*/ */
usb_clear_halt(serial->dev, pipe); usb_clear_halt(serial->dev, pipe);
ret = usb_bulk_msg (serial->dev, pipe, command, sizeof(command), &alen, COMMAND_TIMEOUT); ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT);
if (ret) { if (ret) {
err("%s: Couldn't send command [%d]", serial->type->name, ret); err("%s: Couldn't send command [%d]", serial->type->name, ret);
goto no_firmware; goto no_firmware;
...@@ -383,7 +392,7 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -383,7 +392,7 @@ static int whiteheat_attach (struct usb_serial *serial)
pipe = usb_rcvbulkpipe (serial->dev, command_port->bulk_in_endpointAddress); pipe = usb_rcvbulkpipe (serial->dev, command_port->bulk_in_endpointAddress);
/* See the comment on the usb_clear_halt() above */ /* See the comment on the usb_clear_halt() above */
usb_clear_halt(serial->dev, pipe); usb_clear_halt(serial->dev, pipe);
ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(result), &alen, COMMAND_TIMEOUT); ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT);
if (ret) { if (ret) {
err("%s: Couldn't get results [%d]", serial->type->name, ret); err("%s: Couldn't get results [%d]", serial->type->name, ret);
goto no_firmware; goto no_firmware;
...@@ -485,6 +494,8 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -485,6 +494,8 @@ static int whiteheat_attach (struct usb_serial *serial)
usb_set_serial_port_data(command_port, command_info); usb_set_serial_port_data(command_port, command_info);
command_port->write_urb->complete = command_port_write_callback; command_port->write_urb->complete = command_port_write_callback;
command_port->read_urb->complete = command_port_read_callback; command_port->read_urb->complete = command_port_read_callback;
kfree(result);
kfree(command);
return 0; return 0;
...@@ -526,6 +537,10 @@ static int whiteheat_attach (struct usb_serial *serial) ...@@ -526,6 +537,10 @@ static int whiteheat_attach (struct usb_serial *serial)
no_private: no_private:
; ;
} }
kfree(result);
no_result_buffer:
kfree(command);
no_command_buffer:
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -309,44 +309,6 @@ static int proc_info (struct Scsi_Host *hostptr, char *buffer, char **start, off ...@@ -309,44 +309,6 @@ static int proc_info (struct Scsi_Host *hostptr, char *buffer, char **start, off
* Sysfs interface * Sysfs interface
***********************************************************************/ ***********************************************************************/
/* Output routine for the sysfs info file */
static ssize_t show_info(struct device *dev, char *buffer)
{
char *pos = buffer;
const int length = PAGE_SIZE;
struct scsi_device *sdev = to_scsi_device(dev);
struct us_data *us = (struct us_data*)sdev->host->hostdata[0];
/* print the controller name */
SPRINTF(" Host scsi%d: usb-storage\n", sdev->host->host_no);
/* print product, vendor, and serial number strings */
SPRINTF(" Vendor: %s\n", us->vendor);
SPRINTF(" Product: %s\n", us->product);
SPRINTF("Serial Number: %s\n", us->serial);
/* show the protocol and transport */
SPRINTF(" Protocol: %s\n", us->protocol_name);
SPRINTF(" Transport: %s\n", us->transport_name);
/* show the device flags */
if (pos < buffer + length) {
pos += sprintf(pos, " Quirks:");
DO_FLAG(SINGLE_LUN);
DO_FLAG(SCM_MULT_TARG);
DO_FLAG(FIX_INQUIRY);
DO_FLAG(FIX_CAPACITY);
*(pos++) = '\n';
}
return (pos - buffer);
}
static DEVICE_ATTR(info, S_IRUGO, show_info, NULL);
/* Output routine for the sysfs max_sectors file */ /* Output routine for the sysfs max_sectors file */
static ssize_t show_max_sectors(struct device *dev, char *buf) static ssize_t show_max_sectors(struct device *dev, char *buf)
{ {
...@@ -373,7 +335,6 @@ static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors, ...@@ -373,7 +335,6 @@ static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors,
store_max_sectors); store_max_sectors);
static struct device_attribute *sysfs_device_attr_list[] = { static struct device_attribute *sysfs_device_attr_list[] = {
&dev_attr_info,
&dev_attr_max_sectors, &dev_attr_max_sectors,
NULL, NULL,
}; };
......
...@@ -115,6 +115,13 @@ UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001, ...@@ -115,6 +115,13 @@ UNUSUAL_DEV( 0x04a4, 0x0004, 0x0001, 0x0001,
"DVD-CAM DZ-MV100A Camcorder", "DVD-CAM DZ-MV100A Camcorder",
US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN), US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN),
/* Reported by Simon Levitt <simon@whattf.com>
* This entry needs Sub and Proto fields */
UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100,
"Epson",
"875DC Storage",
US_SC_SCSI, US_PR_CB, NULL, US_FL_FIX_INQUIRY),
/* Reported by Khalid Aziz <khalid@gonehiking.org> /* Reported by Khalid Aziz <khalid@gonehiking.org>
* This entry is needed because the device reports Sub=ff */ * This entry is needed because the device reports Sub=ff */
UNUSUAL_DEV( 0x04b8, 0x0602, 0x0110, 0x0110, UNUSUAL_DEV( 0x04b8, 0x0602, 0x0110, 0x0110,
...@@ -482,11 +489,6 @@ UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999, ...@@ -482,11 +489,6 @@ UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
"Freecom", "Freecom",
"USB-IDE", "USB-IDE",
US_SC_QIC, US_PR_FREECOM, freecom_init, 0), US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
UNUSUAL_DEV( 0x07ab, 0xfc84, 0x0000, 0x9999,
"Freecom",
"FX-5/FX-50",
US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
#endif #endif
UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0133, UNUSUAL_DEV( 0x07af, 0x0004, 0x0100, 0x0133,
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
* Based on <asm-alpha/uaccess.h>. * Based on <asm-alpha/uaccess.h>.
* *
* Copyright (C) 1998, 1999, 2001-2003 Hewlett-Packard Co * Copyright (C) 1998, 1999, 2001-2004 Hewlett-Packard Co
* David Mosberger-Tang <davidm@hpl.hp.com> * David Mosberger-Tang <davidm@hpl.hp.com>
*/ */
...@@ -283,24 +283,23 @@ extern unsigned long __strnlen_user (const char *, long); ...@@ -283,24 +283,23 @@ extern unsigned long __strnlen_user (const char *, long);
__su_ret; \ __su_ret; \
}) })
/* Generic code can't deal with the location-relative format that we use for compactness. */
#define ARCH_HAS_SORT_EXTABLE #define ARCH_HAS_SORT_EXTABLE
#define ARCH_HAS_SEARCH_EXTABLE #define ARCH_HAS_SEARCH_EXTABLE
struct exception_table_entry { struct exception_table_entry {
int addr; /* gp-relative address of insn this fixup is for */ int addr; /* location-relative address of insn this fixup is for */
int cont; /* gp-relative continuation address; if bit 2 is set, r9 is set to 0 */ int cont; /* location-relative continuation addr.; if bit 2 is set, r9 is set to 0 */
}; };
extern void handle_exception (struct pt_regs *regs, const struct exception_table_entry *e); extern void handle_exception (struct pt_regs *regs, const struct exception_table_entry *e);
extern const struct exception_table_entry *search_exception_tables (unsigned long addr); extern const struct exception_table_entry *search_exception_tables (unsigned long addr);
# define SEARCH_EXCEPTION_TABLE(regs) search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri)
static inline int static inline int
done_with_exception (struct pt_regs *regs) done_with_exception (struct pt_regs *regs)
{ {
const struct exception_table_entry *e; const struct exception_table_entry *e;
e = SEARCH_EXCEPTION_TABLE(regs); e = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
if (e) { if (e) {
handle_exception(regs, e); handle_exception(regs, e);
return 1; return 1;
......
...@@ -856,7 +856,6 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, ...@@ -856,7 +856,6 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
/* wrappers around usb_control_msg() for the most common standard requests */ /* wrappers around usb_control_msg() for the most common standard requests */
extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
unsigned char descindex, void *buf, int size); unsigned char descindex, void *buf, int size);
extern int usb_get_device_descriptor(struct usb_device *dev);
extern int usb_get_status(struct usb_device *dev, extern int usb_get_status(struct usb_device *dev,
int type, int target, void *data); int type, int target, void *data);
extern int usb_get_string(struct usb_device *dev, extern int usb_get_string(struct usb_device *dev,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/swapops.h> #include <linux/swapops.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/utsname.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
......
...@@ -124,9 +124,6 @@ ...@@ -124,9 +124,6 @@
(NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \ (NS_TO_JIFFIES((p)->sleep_avg) * MAX_BONUS / \
MAX_SLEEP_AVG) MAX_SLEEP_AVG)
/* spinlock debugging needs this, even on !CONFIG_SMP */
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \ #define TIMESLICE_GRANULARITY(p) (MIN_TIMESLICE * \
(1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \ (1 << (((MAX_BONUS - CURRENT_BONUS(p)) ? : 1) - 1)) * \
...@@ -2859,7 +2856,6 @@ __init int migration_init(void) ...@@ -2859,7 +2856,6 @@ __init int migration_init(void)
#endif #endif
#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
/* /*
* The 'big kernel lock' * The 'big kernel lock'
* *
...@@ -2869,10 +2865,11 @@ __init int migration_init(void) ...@@ -2869,10 +2865,11 @@ __init int migration_init(void)
* been migrated to a proper locking design yet. * been migrated to a proper locking design yet.
* *
* Don't use in new code. * Don't use in new code.
*
* Note: spinlock debugging needs this even on !CONFIG_SMP.
*/ */
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL(kernel_flag); EXPORT_SYMBOL(kernel_flag);
#endif
static void kstat_init_cpu(int cpu) static void kstat_init_cpu(int cpu)
{ {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_ch9.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/info.h> #include <sound/info.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -2560,9 +2561,10 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac ...@@ -2560,9 +2561,10 @@ static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interfac
err = usb_control_msg(dev, usb_sndctrlpipe(dev,0), err = usb_control_msg(dev, usb_sndctrlpipe(dev,0),
0x10, 0x43, 0x0001, 0x000a, NULL, 0, HZ); 0x10, 0x43, 0x0001, 0x000a, NULL, 0, HZ);
if (err < 0) snd_printdd("error sending boot message: %d\n", err); if (err < 0) snd_printdd("error sending boot message: %d\n", err);
err = usb_get_device_descriptor(dev); err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
&dev->descriptor, sizeof(dev->descriptor));
config = dev->actconfig; config = dev->actconfig;
if (err < 0) snd_printdd("error usb_get_device_descriptor: %d\n", err); if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err);
err = usb_reset_configuration(dev); err = usb_reset_configuration(dev);
if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err);
snd_printdd("extigy_boot: new boot length = %d\n", get_cfg_desc(config)->wTotalLength); snd_printdd("extigy_boot: new boot length = %d\n", get_cfg_desc(config)->wTotalLength);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment