Message ID | 1459344056-5234-1-git-send-email-akarwar@marvell.com |
---|---|
State | Changes Requested, archived |
Headers | show |
On Wed, Mar 30, 2016 at 8:20 AM, Amitkumar Karwar <akarwar@marvell.com> wrote: > From: Xinming Hu <huxm@marvell.com> > > Add device tree binding documentation for MARVELL's bluetooth sdio > (sd8897 and sd8997) chip. > > Signed-off-by: Xinming Hu <huxm@marvell.com> > Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> > --- [...] > diff --git a/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt b/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt > new file mode 100644 > index 0000000..172ba83 > --- /dev/null > +++ b/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt > @@ -0,0 +1,57 @@ > +Marvell 8897/8997 (sd8897/sd8997) bluetooth SDIO devices > +------ > + > +Required properties: > + > + - compatible : should be one of the following: > + * "marvell,sd8897-bt" > + * "marvell,sd8997-bt" > + > +Optional properties: > + > + - btmrvl,cal-data : Calibration data downloaded to the device during > + initialization. This is an array of 28 values(u8). btmrvl is not a vendor. These should all be "marvell". > + > + - btmrvl,wakeup-pin : 'wakeup-pin' represent wakeup pin number of the bluetooth > + chip. firmware will use the pin to wakeup host system. > + - btmrvl,wakeup-gap : wakeup gap (in msecs) represent wakeup latency of the host Add units suffix (-msec). > + platform. The value will be configure to fiwmware. s/fiwmware/firmware/ > + This is needed to work chip's sleep feature as expected. > + - interrupt-parent: phandle of the parent interrupt controller > + - interrupts : interrupt pin number to the cpu. driver will request an irq based on > + this interrupt number. during system suspend, the irq will be enabled > + as system wakeup source, so that the bluetooth chip can wakeup host > + platform under certain condition. during system resume, the irq will > + be disabled to make sure unnecessary interrupt is not received. > + > +Example: > + > +IRQ pin 119 is used as system wakeup source interrupt. > +wakeup pin 13 and gap 100ms are configured so that firmware can wakeup host > +using this device side pin and wakeup latency. > +calibration data is also available in below example. > + > +&mmc3 { > + status = "okay"; > + vmmc-supply = <&wlan_en_reg>; > + bus-width = <4>; > + cap-power-off-card; > + keep-power-in-suspend; > + > + #address-cells = <1>; > + #size-cells = <0>; > + btmrvl: btmrvl@2 { Use a generic node name: bluetooth@2 > + compatible = "marvell,sd8897-bt"; > + reg = <2>; > + interrupt-parent = <&pio>; > + interrupts = <119 IRQ_TYPE_LEVEL_LOW>; > + > + btmrvl,cal-data = /bits/ 8 < > + 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02 > + 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00 > + 0x00 0x00 0xf0 0x00>; > + btmrvl,wakeup-pin = <0x0d>; > + btmrvl,wakeup-gap = <0x64>; > + }; > +}; > + > -- > 1.8.1.4 > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Amitkumar, > On some arm-based platforms, we need to configure platform specific > parameters by device tree node and we need define our node as a child > node of parent SDIO host controller. > This patch parses these parameters from device tree. It includes > calibration data download to firmware, wakeup pin configured to firmware, > and soc specific wakeup interrupt pin. > > Signed-off-by: Xinming Hu <huxm@marvell.com> > Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> > --- > drivers/bluetooth/btmrvl_drv.h | 11 ++++++ > drivers/bluetooth/btmrvl_main.c | 33 +++++++++-------- > drivers/bluetooth/btmrvl_sdio.c | 79 +++++++++++++++++++++++++++++++++++++++++ > drivers/bluetooth/btmrvl_sdio.h | 6 ++++ > 4 files changed, 115 insertions(+), 14 deletions(-) > > diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h > index 0590473..f742384 100644 > --- a/drivers/bluetooth/btmrvl_drv.h > +++ b/drivers/bluetooth/btmrvl_drv.h > @@ -23,6 +23,17 @@ > #include <linux/bitops.h> > #include <linux/slab.h> > #include <net/bluetooth/bluetooth.h> > +#include <linux/err.h> > +#include <linux/gpio.h> > +#include <linux/gfp.h> > +#include <linux/interrupt.h> > +#include <linux/io.h> > +#include <linux/of_gpio.h> > +#include <linux/of_platform.h> > +#include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > +#include <linux/slab.h> > +#include <linux/of_irq.h> > > #define BTM_HEADER_LEN 4 > #define BTM_UPLD_SIZE 2312 > diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c > index f25a825..25343ef 100644 > --- a/drivers/bluetooth/btmrvl_main.c > +++ b/drivers/bluetooth/btmrvl_main.c > @@ -510,34 +510,39 @@ static int btmrvl_download_cal_data(struct btmrvl_private *priv, > static int btmrvl_check_device_tree(struct btmrvl_private *priv) > { > struct device_node *dt_node; > + struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; > u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE]; > - int ret; > - u32 val; > + int ret = 0; > + u16 gpio, gap; > + > + if (card->plt_of_node) { > + dt_node = card->plt_of_node; > + ret = of_property_read_u16(dt_node, "btmrvl,wakeup-pin", > + &gpio); > + if (ret) > + gpio = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; > + > + ret = of_property_read_u16(dt_node, "btmrvl,wakeup-gap", > + &gap); > + if (ret) > + gap = (u8)(priv->btmrvl_dev.gpio_gap & 0x00ff); > > - for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") { > - ret = of_property_read_u32(dt_node, "btmrvl,gpio-gap", &val); > - if (!ret) > - priv->btmrvl_dev.gpio_gap = val; > + priv->btmrvl_dev.gpio_gap = (gpio << 8) + gap; > > ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data", > cal_data + BT_CAL_HDR_LEN, > BT_CAL_DATA_SIZE); > - if (ret) { > - of_node_put(dt_node); > + if (ret) > return ret; > - } > > BT_DBG("Use cal data from device tree"); > ret = btmrvl_download_cal_data(priv, cal_data, > BT_CAL_DATA_SIZE); > - if (ret) { > + if (ret) > BT_ERR("Fail to download calibrate data"); > - of_node_put(dt_node); > - return ret; > - } > } > > - return 0; > + return ret; > } > > static int btmrvl_setup(struct hci_dev *hdev) > diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c > index 6ed8acf..c714040 100644 > --- a/drivers/bluetooth/btmrvl_sdio.c > +++ b/drivers/bluetooth/btmrvl_sdio.c > @@ -52,6 +52,68 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = { > {"EXTLAST", NULL, 0, 0xFE}, > }; > > +static const struct of_device_id btmrvl_sdio_of_match_table[] = { > + { .compatible = "marvell,sd8897-bt" }, > + { .compatible = "marvell,sd8997-bt" }, > + { } > +}; is this agreed upon by the DT maintainer? I only want to merge this patch if we have agreement. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Marcel, > From: Marcel Holtmann [mailto:marcel@holtmann.org] > Sent: Friday, April 08, 2016 10:40 PM > To: Amitkumar Karwar > Cc: linux-bluetooth@vger.kernel.org; Nishant Sarmukadam; > wnhuang@chromium.com; devicetree@vger.kernel.org; linux- > kernel@vger.kernel.org; Xinming Hu > Subject: Re: [PATCH v6 2/2] btmrvl: add platform specific wakeup > interrupt support > > Hi Amitkumar, > > > On some arm-based platforms, we need to configure platform specific > > parameters by device tree node and we need define our node as a child > > node of parent SDIO host controller. > > This patch parses these parameters from device tree. It includes > > calibration data download to firmware, wakeup pin configured to > > firmware, and soc specific wakeup interrupt pin. > > > > Signed-off-by: Xinming Hu <huxm@marvell.com> > > Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> > > --- > > drivers/bluetooth/btmrvl_drv.h | 11 ++++++ > > drivers/bluetooth/btmrvl_main.c | 33 +++++++++-------- > > drivers/bluetooth/btmrvl_sdio.c | 79 > > +++++++++++++++++++++++++++++++++++++++++ > > drivers/bluetooth/btmrvl_sdio.h | 6 ++++ > > 4 files changed, 115 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/bluetooth/btmrvl_drv.h > > b/drivers/bluetooth/btmrvl_drv.h index 0590473..f742384 100644 > > --- a/drivers/bluetooth/btmrvl_drv.h > > +++ b/drivers/bluetooth/btmrvl_drv.h > > @@ -23,6 +23,17 @@ > > #include <linux/bitops.h> > > #include <linux/slab.h> > > #include <net/bluetooth/bluetooth.h> > > +#include <linux/err.h> > > +#include <linux/gpio.h> > > +#include <linux/gfp.h> > > +#include <linux/interrupt.h> > > +#include <linux/io.h> > > +#include <linux/of_gpio.h> > > +#include <linux/of_platform.h> > > +#include <linux/platform_device.h> > > +#include <linux/pm_runtime.h> > > +#include <linux/slab.h> > > +#include <linux/of_irq.h> > > > > #define BTM_HEADER_LEN 4 > > #define BTM_UPLD_SIZE 2312 > > diff --git a/drivers/bluetooth/btmrvl_main.c > > b/drivers/bluetooth/btmrvl_main.c index f25a825..25343ef 100644 > > --- a/drivers/bluetooth/btmrvl_main.c > > +++ b/drivers/bluetooth/btmrvl_main.c > > @@ -510,34 +510,39 @@ static int btmrvl_download_cal_data(struct > > btmrvl_private *priv, static int btmrvl_check_device_tree(struct > > btmrvl_private *priv) { > > struct device_node *dt_node; > > + struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; > > u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE]; > > - int ret; > > - u32 val; > > + int ret = 0; > > + u16 gpio, gap; > > + > > + if (card->plt_of_node) { > > + dt_node = card->plt_of_node; > > + ret = of_property_read_u16(dt_node, "btmrvl,wakeup-pin", > > + &gpio); > > + if (ret) > > + gpio = (priv->btmrvl_dev.gpio_gap & 0xff00) >> 8; > > + > > + ret = of_property_read_u16(dt_node, "btmrvl,wakeup-gap", > > + &gap); > > + if (ret) > > + gap = (u8)(priv->btmrvl_dev.gpio_gap & 0x00ff); > > > > - for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") { > > - ret = of_property_read_u32(dt_node, "btmrvl,gpio-gap", > &val); > > - if (!ret) > > - priv->btmrvl_dev.gpio_gap = val; > > + priv->btmrvl_dev.gpio_gap = (gpio << 8) + gap; > > > > ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data", > > cal_data + BT_CAL_HDR_LEN, > > BT_CAL_DATA_SIZE); > > - if (ret) { > > - of_node_put(dt_node); > > + if (ret) > > return ret; > > - } > > > > BT_DBG("Use cal data from device tree"); > > ret = btmrvl_download_cal_data(priv, cal_data, > > BT_CAL_DATA_SIZE); > > - if (ret) { > > + if (ret) > > BT_ERR("Fail to download calibrate data"); > > - of_node_put(dt_node); > > - return ret; > > - } > > } > > > > - return 0; > > + return ret; > > } > > > > static int btmrvl_setup(struct hci_dev *hdev) diff --git > > a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c > > index 6ed8acf..c714040 100644 > > --- a/drivers/bluetooth/btmrvl_sdio.c > > +++ b/drivers/bluetooth/btmrvl_sdio.c > > @@ -52,6 +52,68 @@ static struct memory_type_mapping > mem_type_mapping_tbl[] = { > > {"EXTLAST", NULL, 0, 0xFE}, > > }; > > > > +static const struct of_device_id btmrvl_sdio_of_match_table[] = { > > + { .compatible = "marvell,sd8897-bt" }, > > + { .compatible = "marvell,sd8997-bt" }, > > + { } > > +}; > > is this agreed upon by the DT maintainer? I only want to merge this > patch if we have agreement. > Please hold on for this patch. Rob Herring had suggested to use Linux kernel's generic wake irq handling. We found out it's not suitable for us. We will discuss it with Rob. Regards, Amitkumar -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/devicetree/bindings/btmrvl.txt b/Documentation/devicetree/bindings/btmrvl.txt deleted file mode 100644 index 58f964b..0000000 --- a/Documentation/devicetree/bindings/btmrvl.txt +++ /dev/null @@ -1,29 +0,0 @@ -btmrvl ------- - -Required properties: - - - compatible : must be "btmrvl,cfgdata" - -Optional properties: - - - btmrvl,cal-data : Calibration data downloaded to the device during - initialization. This is an array of 28 values(u8). - - - btmrvl,gpio-gap : gpio and gap (in msecs) combination to be - configured. - -Example: - -GPIO pin 13 is configured as a wakeup source and GAP is set to 100 msecs -in below example. - -btmrvl { - compatible = "btmrvl,cfgdata"; - - btmrvl,cal-data = /bits/ 8 < - 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02 - 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00 - 0x00 0x00 0xf0 0x00>; - btmrvl,gpio-gap = <0x0d64>; -}; diff --git a/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt b/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt new file mode 100644 index 0000000..172ba83 --- /dev/null +++ b/Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt @@ -0,0 +1,57 @@ +Marvell 8897/8997 (sd8897/sd8997) bluetooth SDIO devices +------ + +Required properties: + + - compatible : should be one of the following: + * "marvell,sd8897-bt" + * "marvell,sd8997-bt" + +Optional properties: + + - btmrvl,cal-data : Calibration data downloaded to the device during + initialization. This is an array of 28 values(u8). + + - btmrvl,wakeup-pin : 'wakeup-pin' represent wakeup pin number of the bluetooth + chip. firmware will use the pin to wakeup host system. + - btmrvl,wakeup-gap : wakeup gap (in msecs) represent wakeup latency of the host + platform. The value will be configure to fiwmware. + This is needed to work chip's sleep feature as expected. + - interrupt-parent: phandle of the parent interrupt controller + - interrupts : interrupt pin number to the cpu. driver will request an irq based on + this interrupt number. during system suspend, the irq will be enabled + as system wakeup source, so that the bluetooth chip can wakeup host + platform under certain condition. during system resume, the irq will + be disabled to make sure unnecessary interrupt is not received. + +Example: + +IRQ pin 119 is used as system wakeup source interrupt. +wakeup pin 13 and gap 100ms are configured so that firmware can wakeup host +using this device side pin and wakeup latency. +calibration data is also available in below example. + +&mmc3 { + status = "okay"; + vmmc-supply = <&wlan_en_reg>; + bus-width = <4>; + cap-power-off-card; + keep-power-in-suspend; + + #address-cells = <1>; + #size-cells = <0>; + btmrvl: btmrvl@2 { + compatible = "marvell,sd8897-bt"; + reg = <2>; + interrupt-parent = <&pio>; + interrupts = <119 IRQ_TYPE_LEVEL_LOW>; + + btmrvl,cal-data = /bits/ 8 < + 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02 + 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00 + 0x00 0x00 0xf0 0x00>; + btmrvl,wakeup-pin = <0x0d>; + btmrvl,wakeup-gap = <0x64>; + }; +}; +