Commit 3ab47029 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'driver-core-linus' of...

Merge branch 'driver-core-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6

* 'driver-core-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
  drivers:misc: ti-st: fix unexpected UART close
  drivers:misc: ti-st: free skb on firmware download
  drivers:misc: ti-st: wait for completion at fail
  drivers:misc: ti-st: reinit completion before send
  drivers:misc: ti-st: fail-safe on wrong pkt type
  drivers:misc: ti-st: reinit completion on ver read
  drivers:misc:ti-st: platform hooks for chip states
  drivers:misc: ti-st: avoid a misleading dbg msg
  base/devres.c: quiet sparse noise about context imbalance
  pti: add missing CONFIG_PCI dependency
  drivers/base/devtmpfs.c: correct annotation of `setup_done'
  driver core: fix kernel-doc warning in platform.c
  firmware: fix google/gsmi.c build warning
parents 0cf0adb0 651d62a8
...@@ -397,6 +397,7 @@ static int remove_nodes(struct device *dev, ...@@ -397,6 +397,7 @@ static int remove_nodes(struct device *dev,
static int release_nodes(struct device *dev, struct list_head *first, static int release_nodes(struct device *dev, struct list_head *first,
struct list_head *end, unsigned long flags) struct list_head *end, unsigned long flags)
__releases(&dev->devres_lock)
{ {
LIST_HEAD(todo); LIST_HEAD(todo);
int cnt; int cnt;
......
...@@ -376,7 +376,7 @@ int devtmpfs_mount(const char *mntdir) ...@@ -376,7 +376,7 @@ int devtmpfs_mount(const char *mntdir)
return err; return err;
} }
static __initdata DECLARE_COMPLETION(setup_done); static DECLARE_COMPLETION(setup_done);
static int handle(const char *name, mode_t mode, struct device *dev) static int handle(const char *name, mode_t mode, struct device *dev)
{ {
......
...@@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(platform_bus); ...@@ -33,7 +33,7 @@ EXPORT_SYMBOL_GPL(platform_bus);
/** /**
* arch_setup_pdev_archdata - Allow manipulation of archdata before its used * arch_setup_pdev_archdata - Allow manipulation of archdata before its used
* @dev: platform device * @pdev: platform device
* *
* This is called before platform_device_add() such that any pdev_archdata may * This is called before platform_device_add() such that any pdev_archdata may
* be setup before the platform_notifier is called. So if a user needs to * be setup before the platform_notifier is called. So if a user needs to
......
...@@ -420,7 +420,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size, ...@@ -420,7 +420,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size,
static efi_status_t gsmi_set_variable(efi_char16_t *name, static efi_status_t gsmi_set_variable(efi_char16_t *name,
efi_guid_t *vendor, efi_guid_t *vendor,
unsigned long attr, u32 attr,
unsigned long data_size, unsigned long data_size,
void *data) void *data)
{ {
......
...@@ -146,6 +146,7 @@ config PHANTOM ...@@ -146,6 +146,7 @@ config PHANTOM
config INTEL_MID_PTI config INTEL_MID_PTI
tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
depends on PCI
default n default n
help help
The PTI (Parallel Trace Interface) driver directs The PTI (Parallel Trace Interface) driver directs
......
...@@ -338,6 +338,12 @@ void st_int_recv(void *disc_data, ...@@ -338,6 +338,12 @@ void st_int_recv(void *disc_data,
/* Unknow packet? */ /* Unknow packet? */
default: default:
type = *ptr; type = *ptr;
if (st_gdata->list[type] == NULL) {
pr_err("chip/interface misbehavior dropping"
" frame starting with 0x%02x", type);
goto done;
}
st_gdata->rx_skb = alloc_skb( st_gdata->rx_skb = alloc_skb(
st_gdata->list[type]->max_frame_size, st_gdata->list[type]->max_frame_size,
GFP_ATOMIC); GFP_ATOMIC);
...@@ -354,6 +360,7 @@ void st_int_recv(void *disc_data, ...@@ -354,6 +360,7 @@ void st_int_recv(void *disc_data,
ptr++; ptr++;
count--; count--;
} }
done:
spin_unlock_irqrestore(&st_gdata->lock, flags); spin_unlock_irqrestore(&st_gdata->lock, flags);
pr_debug("done %s", __func__); pr_debug("done %s", __func__);
return; return;
...@@ -717,9 +724,10 @@ static void st_tty_close(struct tty_struct *tty) ...@@ -717,9 +724,10 @@ static void st_tty_close(struct tty_struct *tty)
*/ */
spin_lock_irqsave(&st_gdata->lock, flags); spin_lock_irqsave(&st_gdata->lock, flags);
for (i = ST_BT; i < ST_MAX_CHANNELS; i++) { for (i = ST_BT; i < ST_MAX_CHANNELS; i++) {
if (st_gdata->list[i] != NULL) if (st_gdata->is_registered[i] == true)
pr_err("%d not un-registered", i); pr_err("%d not un-registered", i);
st_gdata->list[i] = NULL; st_gdata->list[i] = NULL;
st_gdata->is_registered[i] = false;
} }
st_gdata->protos_registered = 0; st_gdata->protos_registered = 0;
spin_unlock_irqrestore(&st_gdata->lock, flags); spin_unlock_irqrestore(&st_gdata->lock, flags);
......
...@@ -68,6 +68,7 @@ void validate_firmware_response(struct kim_data_s *kim_gdata) ...@@ -68,6 +68,7 @@ void validate_firmware_response(struct kim_data_s *kim_gdata)
if (unlikely(skb->data[5] != 0)) { if (unlikely(skb->data[5] != 0)) {
pr_err("no proper response during fw download"); pr_err("no proper response during fw download");
pr_err("data6 %x", skb->data[5]); pr_err("data6 %x", skb->data[5]);
kfree_skb(skb);
return; /* keep waiting for the proper response */ return; /* keep waiting for the proper response */
} }
/* becos of all the script being downloaded */ /* becos of all the script being downloaded */
...@@ -210,6 +211,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) ...@@ -210,6 +211,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
pr_err(" waiting for ver info- timed out "); pr_err(" waiting for ver info- timed out ");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
INIT_COMPLETION(kim_gdata->kim_rcvd);
version = version =
MAKEWORD(kim_gdata->resp_buffer[13], MAKEWORD(kim_gdata->resp_buffer[13],
...@@ -298,6 +300,7 @@ static long download_firmware(struct kim_data_s *kim_gdata) ...@@ -298,6 +300,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
switch (((struct bts_action *)ptr)->type) { switch (((struct bts_action *)ptr)->type) {
case ACTION_SEND_COMMAND: /* action send */ case ACTION_SEND_COMMAND: /* action send */
pr_debug("S");
action_ptr = &(((struct bts_action *)ptr)->data[0]); action_ptr = &(((struct bts_action *)ptr)->data[0]);
if (unlikely if (unlikely
(((struct hci_command *)action_ptr)->opcode == (((struct hci_command *)action_ptr)->opcode ==
...@@ -335,6 +338,10 @@ static long download_firmware(struct kim_data_s *kim_gdata) ...@@ -335,6 +338,10 @@ static long download_firmware(struct kim_data_s *kim_gdata)
release_firmware(kim_gdata->fw_entry); release_firmware(kim_gdata->fw_entry);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
/* reinit completion before sending for the
* relevant wait
*/
INIT_COMPLETION(kim_gdata->kim_rcvd);
/* /*
* Free space found in uart buffer, call st_int_write * Free space found in uart buffer, call st_int_write
...@@ -361,6 +368,7 @@ static long download_firmware(struct kim_data_s *kim_gdata) ...@@ -361,6 +368,7 @@ static long download_firmware(struct kim_data_s *kim_gdata)
} }
break; break;
case ACTION_WAIT_EVENT: /* wait */ case ACTION_WAIT_EVENT: /* wait */
pr_debug("W");
if (!wait_for_completion_timeout if (!wait_for_completion_timeout
(&kim_gdata->kim_rcvd, (&kim_gdata->kim_rcvd,
msecs_to_jiffies(CMD_RESP_TIME))) { msecs_to_jiffies(CMD_RESP_TIME))) {
...@@ -434,11 +442,17 @@ long st_kim_start(void *kim_data) ...@@ -434,11 +442,17 @@ long st_kim_start(void *kim_data)
{ {
long err = 0; long err = 0;
long retry = POR_RETRY_COUNT; long retry = POR_RETRY_COUNT;
struct ti_st_plat_data *pdata;
struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
pr_info(" %s", __func__); pr_info(" %s", __func__);
pdata = kim_gdata->kim_pdev->dev.platform_data;
do { do {
/* platform specific enabling code here */
if (pdata->chip_enable)
pdata->chip_enable(kim_gdata);
/* Configure BT nShutdown to HIGH state */ /* Configure BT nShutdown to HIGH state */
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
mdelay(5); /* FIXME: a proper toggle */ mdelay(5); /* FIXME: a proper toggle */
...@@ -460,6 +474,12 @@ long st_kim_start(void *kim_data) ...@@ -460,6 +474,12 @@ long st_kim_start(void *kim_data)
pr_info("ldisc_install = 0"); pr_info("ldisc_install = 0");
sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, sysfs_notify(&kim_gdata->kim_pdev->dev.kobj,
NULL, "install"); NULL, "install");
/* the following wait is never going to be completed,
* since the ldisc was never installed, hence serving
* as a mdelay of LDISC_TIME msecs */
err = wait_for_completion_timeout
(&kim_gdata->ldisc_installed,
msecs_to_jiffies(LDISC_TIME));
err = -ETIMEDOUT; err = -ETIMEDOUT;
continue; continue;
} else { } else {
...@@ -472,6 +492,13 @@ long st_kim_start(void *kim_data) ...@@ -472,6 +492,13 @@ long st_kim_start(void *kim_data)
pr_info("ldisc_install = 0"); pr_info("ldisc_install = 0");
sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, sysfs_notify(&kim_gdata->kim_pdev->dev.kobj,
NULL, "install"); NULL, "install");
/* this wait might be completed, though in the
* tty_close() since the ldisc is already
* installed */
err = wait_for_completion_timeout
(&kim_gdata->ldisc_installed,
msecs_to_jiffies(LDISC_TIME));
err = -EINVAL;
continue; continue;
} else { /* on success don't retry */ } else { /* on success don't retry */
break; break;
...@@ -489,6 +516,8 @@ long st_kim_stop(void *kim_data) ...@@ -489,6 +516,8 @@ long st_kim_stop(void *kim_data)
{ {
long err = 0; long err = 0;
struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
struct ti_st_plat_data *pdata =
kim_gdata->kim_pdev->dev.platform_data;
INIT_COMPLETION(kim_gdata->ldisc_installed); INIT_COMPLETION(kim_gdata->ldisc_installed);
...@@ -515,6 +544,10 @@ long st_kim_stop(void *kim_data) ...@@ -515,6 +544,10 @@ long st_kim_stop(void *kim_data)
gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
mdelay(1); mdelay(1);
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
/* platform specific disable */
if (pdata->chip_disable)
pdata->chip_disable(kim_gdata);
return err; return err;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define pr_fmt(fmt) "(stll) :" fmt #define pr_fmt(fmt) "(stll) :" fmt
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/ti_wilink_st.h> #include <linux/ti_wilink_st.h>
/**********************************************************************/ /**********************************************************************/
...@@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data, ...@@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data,
static void ll_device_want_to_sleep(struct st_data_s *st_data) static void ll_device_want_to_sleep(struct st_data_s *st_data)
{ {
struct kim_data_s *kim_data;
struct ti_st_plat_data *pdata;
pr_debug("%s", __func__); pr_debug("%s", __func__);
/* sanity check */ /* sanity check */
if (st_data->ll_state != ST_LL_AWAKE) if (st_data->ll_state != ST_LL_AWAKE)
...@@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data) ...@@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
send_ll_cmd(st_data, LL_SLEEP_ACK); send_ll_cmd(st_data, LL_SLEEP_ACK);
/* update state */ /* update state */
st_data->ll_state = ST_LL_ASLEEP; st_data->ll_state = ST_LL_ASLEEP;
/* communicate to platform about chip asleep */
kim_data = st_data->kim_data;
pdata = kim_data->kim_pdev->dev.platform_data;
if (pdata->chip_asleep)
pdata->chip_asleep(NULL);
} }
static void ll_device_want_to_wakeup(struct st_data_s *st_data) static void ll_device_want_to_wakeup(struct st_data_s *st_data)
{ {
struct kim_data_s *kim_data;
struct ti_st_plat_data *pdata;
/* diff actions in diff states */ /* diff actions in diff states */
switch (st_data->ll_state) { switch (st_data->ll_state) {
case ST_LL_ASLEEP: case ST_LL_ASLEEP:
...@@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data) ...@@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data)
} }
/* update state */ /* update state */
st_data->ll_state = ST_LL_AWAKE; st_data->ll_state = ST_LL_AWAKE;
/* communicate to platform about chip wakeup */
kim_data = st_data->kim_data;
pdata = kim_data->kim_pdev->dev.platform_data;
if (pdata->chip_asleep)
pdata->chip_awake(NULL);
} }
/**********************************************************************/ /**********************************************************************/
......
...@@ -410,7 +410,28 @@ struct gps_event_hdr { ...@@ -410,7 +410,28 @@ struct gps_event_hdr {
u16 plen; u16 plen;
} __attribute__ ((packed)); } __attribute__ ((packed));
/* platform data */ /**
* struct ti_st_plat_data - platform data shared between ST driver and
* platform specific board file which adds the ST device.
* @nshutdown_gpio: Host's GPIO line to which chip's BT_EN is connected.
* @dev_name: The UART/TTY name to which chip is interfaced. (eg: /dev/ttyS1)
* @flow_cntrl: Should always be 1, since UART's CTS/RTS is used for PM
* purposes.
* @baud_rate: The baud rate supported by the Host UART controller, this will
* be shared across with the chip via a HCI VS command from User-Space Init
* Mgr application.
* @suspend:
* @resume: legacy PM routines hooked to platform specific board file, so as
* to take chip-host interface specific action.
* @chip_enable:
* @chip_disable: Platform/Interface specific mux mode setting, GPIO
* configuring, Host side PM disabling etc.. can be done here.
* @chip_asleep:
* @chip_awake: Chip specific deep sleep states is communicated to Host
* specific board-xx.c to take actions such as cut UART clocks when chip
* asleep or run host faster when chip awake etc..
*
*/
struct ti_st_plat_data { struct ti_st_plat_data {
long nshutdown_gpio; long nshutdown_gpio;
unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
...@@ -418,6 +439,10 @@ struct ti_st_plat_data { ...@@ -418,6 +439,10 @@ struct ti_st_plat_data {
unsigned long baud_rate; unsigned long baud_rate;
int (*suspend)(struct platform_device *, pm_message_t); int (*suspend)(struct platform_device *, pm_message_t);
int (*resume)(struct platform_device *); int (*resume)(struct platform_device *);
int (*chip_enable) (struct kim_data_s *);
int (*chip_disable) (struct kim_data_s *);
int (*chip_asleep) (struct kim_data_s *);
int (*chip_awake) (struct kim_data_s *);
}; };
#endif /* TI_WILINK_ST_H */ #endif /* TI_WILINK_ST_H */
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