Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716AbcDVMtJ (ORCPT ); Fri, 22 Apr 2016 08:49:09 -0400 Received: from ipv4.connman.net ([82.165.8.211]:43405 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752101AbcDVMtH convert rfc822-to-8bit (ORCPT ); Fri, 22 Apr 2016 08:49:07 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [PATCH v7] Bluetooth: hci_uart: Support firmware download for Marvell From: Marcel Holtmann In-Reply-To: <2119fc93636742459899d50f2c1fcb8d@SC-EXCH04.marvell.com> Date: Fri, 22 Apr 2016 14:49:09 +0200 Cc: Linux Bluetooth , LKML , Ganapathi Bhat , Cathy Luo Content-Transfer-Encoding: 8BIT Message-Id: References: <1459845266-2771-1-git-send-email-akarwar@marvell.com> <2A69CC2B-1FC2-4148-8564-38335A87CCD7@holtmann.org> <2119fc93636742459899d50f2c1fcb8d@SC-EXCH04.marvell.com> To: Amitkumar Karwar X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1115 Lines: 27 Hi Amitkumar, >>>> + >>>> +static int mrvl_setup(struct hci_uart *hu) { >>>> + struct mrvl_data *mrvl = hu->priv; >>>> + >>>> + mrvl_init_fw_data(hu); >>>> + set_bit(HCI_UART_DNLD_FW, &mrvl->flags); >>>> + >>>> + return hci_uart_dnld_fw(hu); >>>> +} >>> >>> So this is clearly the wrong spot. When ->setup is called it is >>> expected that HCI is ready. You are misusing it here. >>> >> >> Sure. We will move this to mrvl_open() where HCI is not yet initialized. > > We tried moving firmware download to mrvl_open(), but it's not feasible. "hu->proto" is not yet initialized at that time. So when the data/ack is received during firmware download, we can't have Marvell specific handling. Also, I can see other vendor's (broadcomm, Intel) have done firmware download in setup handler. firmware download in ->setup() is fine as long as it uses HCI commands. If it does not use HCI commands, then we need to come up with something new. The problem here is that for all intense and purposes once ->setup() is called, then assumption is that you are in an HCI capable transport and it is ready. Regards Marcel