Re: [PATCH 4/6] drivers:misc: sources for Init manager module

Previous thread: Build error with v2.6.34-rc2-51-g7b1f513 by Chris Clayton on Monday, March 22, 2010 - 2:15 pm. (2 messages)

Next thread: [PATCH] kbuild: Include gen_initramfs_list.sh and the file list in the .d file by Jason Gunthorpe on Monday, March 22, 2010 - 3:49 pm. (2 messages)
From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

Greg/Alan & the linux-kernel community,

Texas Instruments has introduced it's new series of WiLink chipsets
which has Bluetooth, WLAN, FM-Rx and FM-Tx and GPS on 1 single chip.
This series of chipsets allow apps processor to interface with the chip
over a single UART mux-ed for all 3 (BT,FM and GPS) cores on chip and
SDIO for WLAN.

The following list of patches introduces a new line discipline which allows
such muxing to happen, and 3 different BT, FM and GPS drivers would sit on
top of this driver (registering/unregistering) and glue this to relevant s/w
stacks.

This has been verified to work on TI's OMAP platforms(34xx,36xx and 44xx).
--

From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

Texas Instruments BT, FM and GPS combo chips/drivers
make use of a single TTY to communicate with the chip.
This is the common header file for both the ST driver and the
protocol drivers which intend to use ST as their mode of
transport.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/ti-st/fm.h |   13 +++++++
 drivers/misc/ti-st/st.h |   85 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/fm.h
 create mode 100644 drivers/misc/ti-st/st.h

diff --git a/drivers/misc/ti-st/fm.h b/drivers/misc/ti-st/fm.h
new file mode 100644
index 0000000..be41453
--- /dev/null
+++ b/drivers/misc/ti-st/fm.h
@@ -0,0 +1,13 @@
+struct fm_event_hdr {
+	unsigned char plen;
+} __attribute__ ((packed));
+
+#define FM_MAX_FRAME_SIZE 0xFF	/* TODO: */
+#define FM_EVENT_HDR_SIZE 1	/* size of fm_event_hdr */
+#define ST_FM_CH8_PKT 0x8
+
+/* gps stuff */
+struct gps_event_hdr {
+unsigned char opcode;
+unsigned short plen;
+} __attribute__ ((packed));
diff --git a/drivers/misc/ti-st/st.h b/drivers/misc/ti-st/st.h
new file mode 100644
index 0000000..ec821d2
--- /dev/null
+++ b/drivers/misc/ti-st/st.h
@@ -0,0 +1,85 @@
+/*
+ *  Shared Transport Header file
+ *	To be included by the protocol stack drivers for
+ *	Texas Instruments BT,FM and GPS combo chip drivers
+ *
+ *  Copyright (C) 2009 Texas Instruments
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with ...
From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

Texas Instruments BT, FM and GPS combo chips/drivers
make use of a single TTY to communicate with the chip.
This module constitutes the proprietary power management
protocol from TI for the BT/FM/GPS combo chips

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/ti-st/st_ll.c |  169 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/ti-st/st_ll.h |   67 +++++++++++++++++
 2 files changed, 236 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/st_ll.c
 create mode 100644 drivers/misc/ti-st/st_ll.h

diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
new file mode 100644
index 0000000..5e42cbe
--- /dev/null
+++ b/drivers/misc/ti-st/st_ll.c
@@ -0,0 +1,169 @@
+/*
+ *  Shared Transport driver
+ *	HCI-LL module responsible for TI proprietary HCI_LL protocol
+ *  Copyright (C) 2009 Texas Instruments
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include "st_ll.h"
+
+/* all debug macros go in here */
+#define ST_LL_ERR(fmt, arg...)  printk(KERN_ERR "(stll):"fmt"\n" , ## arg)
+#if defined(DEBUG)		/* limited debug messages */
+#define ST_LL_DBG(fmt, arg...)  printk(KERN_INFO "(stll):"fmt"\n" , ## arg)
+#define ST_LL_VER(fmt, arg...)
+#elif defined(VERBOSE)		/* very verbose */
+#define ST_LL_DBG(fmt, arg...)  printk(KERN_INFO "(stll):"fmt"\n" , ## ...
From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

A new N_TI_SHARED line discipline added for TI BT/FM/GPS
combo chips which make use of same TTY to communicate
with chip. This is to be made use of individual protocol
BT/FM/GPS drivers.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 include/linux/tty.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4409967..3eda091 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
  */
 #define NR_UNIX98_PTY_DEFAULT	4096      /* Default maximum for Unix98 ptys */
 #define NR_UNIX98_PTY_MAX	(1 << MINORBITS) /* Absolute limit */
-#define NR_LDISCS		20
+#define NR_LDISCS		21
 
 /* line disciplines */
 #define N_TTY		0
@@ -48,6 +48,7 @@
 #define N_PPS		18	/* Pulse per Second */
 
 #define N_V253		19	/* Codec control over voice modem */
+#define N_TI_SHARED	20	/* for TI's WL7 connectivity chips */
 
 /*
  * This character is the same as _POSIX_VDISABLE: it cannot be used as
-- 
1.5.4.3

--

From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

Texas Instruments BT, FM and GPS combo chips/drivers
make use of a single TTY to communicate with the chip.
This module constitutes the core logic, TTY ldisc driver
and the exported symbols for registering/unregistering of
the protocol drivers such as BT/FM/GPS.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/ti-st/st_core.c | 1057 ++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/ti-st/st_core.h |   92 ++++
 2 files changed, 1149 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/st_core.c
 create mode 100644 drivers/misc/ti-st/st_core.h

diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
new file mode 100644
index 0000000..1cb7c0a
--- /dev/null
+++ b/drivers/misc/ti-st/st_core.c
@@ -0,0 +1,1057 @@
+/*
+ *  Shared Transport Line discipline driver Core
+ *	This hooks up ST KIM driver and ST LL driver
+ *  Copyright (C) 2009 Texas Instruments
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/tty.h>
+
+/* understand BT, FM and GPS for now */
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+#include <net/bluetooth/hci.h>
+#include "fm.h"
+/*
+ * packet formats for fm and gps
+ * #include "gps.h"
+ */
+#include ...
From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

Kernel Space Init-Manager works along with User-Mode
Init Manager daemon running to maintain the UART state.
It also is a platform driver with a relevant platform device
in the board-*.c along with the list of BT/FM/GPS chip enable
gpio configuration

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/ti-st/st_kim.c |  717 +++++++++++++++++++++++++++++++++++++++++++
 drivers/misc/ti-st/st_kim.h |  151 +++++++++
 2 files changed, 868 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/st_kim.c
 create mode 100644 drivers/misc/ti-st/st_kim.h

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
new file mode 100644
index 0000000..20d6927
--- /dev/null
+++ b/drivers/misc/ti-st/st_kim.c
@@ -0,0 +1,717 @@
+/*
+ *  Shared Transport Line discipline driver Core
+ *	Init Manager module responsible for GPIO control
+ *	and firmware download
+ *  Copyright (C) 2009 Texas Instruments
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/jiffies.h>
+#include <linux/firmware.h>
+#include <linux/delay.h>
+#include <linux/wait.h>
+#include <linux/gpio.h>
+
+#include <linux/sched.h>
+
+#include "st_kim.h"
+/* understand BT events for fw response */
+#include <net/bluetooth/bluetooth.h>
+#include ...
From: Greg KH
Date: Monday, March 22, 2010 - 2:36 pm

As you are creating sysfs attributes, you have to have
Documentation/ABI/ updates as well.  Please include them so we can see
what you are trying to do here.

And why "raw" attributes and not device ones?

thanks,

greg k-h
--

From: Savoy, Pavan
Date: Monday, March 22, 2010 - 3:03 pm

----------------------
Thanks & Regards,
Pavan Savoy | x0099669
________________________________________
From: Greg KH [gregkh@suse.de]
Sent: Tuesday, March 23, 2010 3:06 AM
To: Savoy, Pavan
Cc: alan@lxorguk.ukuu.org.uk; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] drivers:misc: sources for Init manager module


[pavan] >>>>>>>>
I am creating a sysfs entry for the daemon/service to write in it's PID to the sysfs entry, so
as to whenever a new protocol driver - BT/FM or GPS wants to use the N_TI_SHARED ldisc, 
the driver would then send signal to daemon on this PID.

The source for this problem, was that I could not install line discipline from kernel space.

From 92d89d132b5036d8ab58ce4f36b24bb1859610e0 Mon Sep 17 00:00:00 2001
From: Pavan Savoy <pavan_savoy@ti.com>
Date: Mon, 22 Mar 2010 18:11:32 -0400
Subject: [PATCH 1/1] Documentation/ABI: for N_TI_SHARED ldisc
N_TI_SHARED creates a sysfs entry to communicate
with the application/daemon which would want to install/
un-install the line discipline, it's documentation
now exists in testing/ subdirectory.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 Documentation/ABI/testing/sysfs-uim |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-uim
diff --git a/Documentation/ABI/testing/sysfs-uim b/Documentation/ABI/testing/sysfs-uim
new file mode 100644
index 0000000..899aa4d
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-uim
@@ -0,0 +1,24 @@
+What:           /sys/uim
+Date:           March 22
+Contact:        Pavan Savoy <pavan_savoy@ti.com>
+Description:
+                Create a new kobject to pass information about the
+  N_TI_SHARED line discipline created to application/daemon
+  which would install/un-install line discipline.
+
+What:           /sys/uim/pid
+Date:           March 22
+Contact:        Pavan Savoy <pavan_savoy@ti.com>
+Description:
+  The daemon/application wanting to use the line discipline
+ ...
From: Greg KH
Date: Tuesday, March 23, 2010 - 7:23 pm

Ick.  Please fix your email client to quote properly.  There are
hundreds of free email programs out there that will do that.  Heck,

Then document it.  All sysfs files need documentation.

Hm, writing a PID to a sysfs file?  Oh, that's going to be ripe for

Are you sure?  I thought the bluetooth core did this already.  Have you

No, you don't get to create a new root sysfs file, sorry.  Please put it
in the correct subsystem location, if anywhere at all.

thanks,

greg k-h
--

From: Marcel Holtmann
Date: Wednesday, March 24, 2010 - 1:04 am

I didn't have time to look at it at all so far. However I think this
should just go via a proper review process. And it might need some
architecture review first. It is clearly not a candidate for staging
since it is not really self-contained.

Regards

Marcel


--

From: Greg KH
Date: Monday, March 22, 2010 - 2:34 pm

NO!

Please use the existing debug macros (dev_printk and friends) and do not
roll your own.

thanks,

greg k-h
--

From: Alan Cox
Date: Tuesday, March 23, 2010 - 8:24 am

What if you have multiple devices at once one in each state ?

Again shouldn't be using globals and needs to support multiple devices.
See the tty_struct - there is a field for an ldisc pointer, stuff

Explain the locking on this NULL test - what stops it becoming NULL
between the if and the assignment ?


I think this code needs a fair bit of work at this point - locking,
supporting multiple devices at once etc.

Staging perhaps ?

--

From: pavan_savoy
Date: Monday, March 22, 2010 - 2:19 pm

From: Pavan Savoy <pavan_savoy@ti.com>

This change adds the Kconfig and Make file for TI's
ST line discipline driver and the BlueZ driver for BT
core of the TI BT/FM/GPS combo chip.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/Kconfig        |    1 +
 drivers/misc/Makefile       |    1 +
 drivers/misc/ti-st/Kconfig  |   24 ++++++++++++++++++++++++
 drivers/misc/ti-st/Makefile |    7 +++++++
 4 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/Kconfig
 create mode 100644 drivers/misc/ti-st/Makefile

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 625e3a6..c059bca 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -344,5 +344,6 @@ source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
 source "drivers/misc/iwmc3200top/Kconfig"
+source "drivers/misc/ti-st/Kconfig"
 
 endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c221917..021f282 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -30,3 +30,4 @@ obj-$(CONFIG_IWMC3200TOP)      += iwmc3200top/
 obj-$(CONFIG_HWLAT_DETECTOR)	+= hwlat_detector.o
 obj-y				+= eeprom/
 obj-y				+= cb710/
+obj-y				+= ti-st/
diff --git a/drivers/misc/ti-st/Kconfig b/drivers/misc/ti-st/Kconfig
new file mode 100644
index 0000000..18eea1c
--- /dev/null
+++ b/drivers/misc/ti-st/Kconfig
@@ -0,0 +1,24 @@
+#
+# TI's shared transport line discipline and the protocol
+# drivers (BT, FM and GPS)
+#
+menu "Texas Instruments shared transport line discipline"
+    config TI_ST
+    tristate "shared transport core driver"
+    select FW_LOADER
+    help
+        This enables the shared transport core driver for TI
+	    BT / FM and GPS combo chips.This enables protocol drivers
+	    to register themselves with core and send data, the responses
+	    are returned to relevant protocol drivers based on their
+	    packet types.
+
+    config ST_BT
+    ...
From: Greg KH
Date: Monday, March 22, 2010 - 2:34 pm

This patch breaks the build if you were to apply them in order, or hit
is in a 'git bisect' session.  Please always make it so that no
individual patch would ever break anything.

thanks,

greg k-h
--

From: Greg KH
Date: Monday, March 22, 2010 - 2:35 pm

Why 'misc'?  Why not 'char' like all the other ldiscs?

Or 'drivers/ldisc' to be more specific?

thanks,

greg k-h
--

From: Tilman Schmidt
Date: Monday, March 22, 2010 - 5:07 pm

Not wanting to nitpick, but the majority of ldiscs do not live
in drivers/char. There is a whole lot of them in drivers/net, a
handful scattered over various other drivers/ places like
drivers/bluetooth, drivers/input, drivers/isdn, drivers/pps,
and even one outside the drivers/ tree, in sound/.
(Leaving aside the one in staging.)

HTH,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

From: Alan Cox
Date: Tuesday, March 23, 2010 - 8:18 am

On Mon, 22 Mar 2010 14:35:30 -0700

We've discussed having /tty or drivers/tty for a while. The ldiscs are
currently everywhere - drivers/net, isdn, char ....

I am not sure an ldisc directory helps though - slip and ppp are in
drivers/net for example and clearly belong there.
--

From: Greg KH
Date: Tuesday, March 23, 2010 - 7:19 pm

Yeah, good point.  I like the idea of a tty/ directory for the tty core
in the future if it's really needed.

thanks,

greg k-h
--

From: Randy Dunlap
Date: Monday, March 22, 2010 - 2:45 pm

I'd be careful.  There are some places in the kernel tree where ST

That select looks unsafe.  You don't know that CONFIG_NET  is even enabled here,




-- 
~Randy
--

From: Savoy, Pavan
Date: Monday, March 22, 2010 - 3:37 pm

patch below....
_______________________________________
From: Randy Dunlap [randy.dunlap@oracle.com]
Sent: Tuesday, March 23, 2010 3:15 AM
To: Savoy, Pavan
Cc: gregkh@suse.de; alan@lxorguk.ukuu.org.uk; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] drivers:misc: Kconfig, Makefile for TI's ST ldisc



I'd be careful.  There are some places in the kernel tree where ST

That select looks unsafe.  You don't know that CONFIG_NET  is even enabled here,




--
~Randy



From 91b326a876066f0724f08957ee446f6b6bbed40e Mon Sep 17 00:00:00 2001
From: Pavan Savoy <pavan_savoy@ti.com>
Date: Mon, 22 Mar 2010 16:40:19 -0400
Subject: [PATCH 2/7] drivers:misc: Kconfig, Makefile for TI's ST ldisc
This change adds the Kconfig and Make file for TI's
ST line discipline driver and the BlueZ driver for BT
core of the TI BT/FM/GPS combo chip.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
---
 drivers/misc/Kconfig        |    1 +
 drivers/misc/Makefile       |    1 +
 drivers/misc/ti-st/Kconfig  |   24 ++++++++++++++++++++++++
 drivers/misc/ti-st/Makefile |    7 +++++++
 4 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ti-st/Kconfig
 create mode 100644 drivers/misc/ti-st/Makefile
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 625e3a6..c059bca 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -344,5 +344,6 @@ source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
 source "drivers/misc/iwmc3200top/Kconfig"
+source "drivers/misc/ti-st/Kconfig"
 
 endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index c221917..021f282 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -30,3 +30,4 @@ obj-$(CONFIG_IWMC3200TOP)      += iwmc3200top/
 obj-$(CONFIG_HWLAT_DETECTOR) += hwlat_detector.o
 obj-y    += eeprom/
 obj-y    += cb710/
+obj-y    += ti-st/
diff --git a/drivers/misc/ti-st/Kconfig ...
From: Randy Dunlap
Date: Monday, March 22, 2010 - 3:49 pm

There are no tabs above.  They appear to have been eaten (assuming that

         ^^^^

I guess that you'll need to do something about that.


-- 
~Randy
--

From: Alan Cox
Date: Tuesday, March 23, 2010 - 8:20 am

Be more specific or some future TI shared bus protocol might cause
confusion N_TI_WL7 sounds fine.

Alan
--

Previous thread: Build error with v2.6.34-rc2-51-g7b1f513 by Chris Clayton on Monday, March 22, 2010 - 2:15 pm. (2 messages)

Next thread: [PATCH] kbuild: Include gen_initramfs_list.sh and the file list in the .d file by Jason Gunthorpe on Monday, March 22, 2010 - 3:49 pm. (2 messages)