diff options
| author | fsd017 <fsd017@motorola.com> | 2013-11-29 16:20:15 -0600 | 
|---|---|---|
| committer | James Wylder <jwylder@motorola.com> | 2014-03-05 17:46:54 -0600 | 
| commit | 2d07e6aa2b5ba78b241cba2a8ca36063e37239a8 (patch) | |
| tree | b8e0df9b10d68af66c5928e4cbe533c9615ff1e8 | |
| parent | 0504d30099c68e913ddeab439f1b1098077a0157 (diff) | |
| download | olio-linux-3.10-2d07e6aa2b5ba78b241cba2a8ca36063e37239a8.tar.xz olio-linux-3.10-2d07e6aa2b5ba78b241cba2a8ca36063e37239a8.zip  | |
IKG5-1475 : Add m4 firmware filename to device tree
Change-Id: I677e5d44f0a2ebef1938d8e56672205725c6808d
Reviewed-on: http://gerrit.pcs.mot.com/585574
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Jee Su Chang <w20740@motorola.com>
Reviewed-by: Douglas Zobel <dzobel1@motorola.com>
Reviewed-by: James Wylder <jwylder@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
| -rw-r--r-- | arch/arm/boot/dts/omap3-minnow.dtsi | 1 | ||||
| -rw-r--r-- | drivers/mfd/m4sensorhub-core.c | 13 | ||||
| -rw-r--r-- | drivers/mfd/m4sensorhub-stm32-fw.c | 6 | ||||
| -rw-r--r-- | include/linux/m4sensorhub.h | 1 | 
4 files changed, 17 insertions, 4 deletions
diff --git a/arch/arm/boot/dts/omap3-minnow.dtsi b/arch/arm/boot/dts/omap3-minnow.dtsi index ce18245f0ed..562205e34dd 100644 --- a/arch/arm/boot/dts/omap3-minnow.dtsi +++ b/arch/arm/boot/dts/omap3-minnow.dtsi @@ -122,6 +122,7 @@  		mot,boot0-gpio  = <&gpio1 21 0>; /* gpio-021 */  		mot,boot1-gpio  = <&gpio1 24 0>; /* gpio-024 */  		mot,enable-gpio = <&gpio1 28 0>; /* gpio-028 */ +		mot,fw-filename = "m4sensorhub-p0_minnow.bin";  	};  }; diff --git a/drivers/mfd/m4sensorhub-core.c b/drivers/mfd/m4sensorhub-core.c index cf1a363921a..cd86cc7e7c2 100644 --- a/drivers/mfd/m4sensorhub-core.c +++ b/drivers/mfd/m4sensorhub-core.c @@ -127,12 +127,14 @@ static void minnow_m4sensorhub_hw_reset(struct m4sensorhub_data *m4sensorhub)  	gpio_set_value(m4sensorhub->hwconfig.reset_gpio, 1);  } +  /* callback from driver to initialize hardware on probe */  static int minnow_m4sensorhub_hw_init(struct m4sensorhub_data *m4sensorhub,  		struct device_node *node)  {  	int gpio;  	int err = -EINVAL; +	const char *fp = NULL;  	if (!m4sensorhub) {  		printk(KERN_ERR "m4sensorhub_hw_init: invalid pointer\n"); @@ -145,6 +147,14 @@ static int minnow_m4sensorhub_hw_init(struct m4sensorhub_data *m4sensorhub,  		goto error;  	} +	of_property_read_string(node, "mot,fw-filename", &fp); +	if (fp == NULL) { +		pr_err("Missing M4 sensorhub firmware filename\n"); +		err = -EINVAL; +		goto error; +	} +	m4sensorhub->filename = (char *)fp; +  	gpio = of_get_named_gpio_flags(node, "mot,irq-gpio", 0, NULL);  	err = (gpio < 0) ? -ENODEV : gpio_request(gpio, "m4sensorhub-intr");  	if (err) { @@ -225,6 +235,7 @@ error_reset:  	gpio_free(m4sensorhub->hwconfig.irq_gpio);  	m4sensorhub->hwconfig.irq_gpio = -1;  error: +	m4sensorhub->filename = NULL;  	return err;  } @@ -266,6 +277,8 @@ static void minnow_m4sensorhub_hw_free(struct m4sensorhub_data *m4sensorhub)  		gpio_free(m4sensorhub->hwconfig.mpu_9150_en_gpio);  		m4sensorhub->hwconfig.mpu_9150_en_gpio = -1;  	} + +	m4sensorhub->filename = NULL;  }  /* END BOARD FILE FUNCTIONS */ diff --git a/drivers/mfd/m4sensorhub-stm32-fw.c b/drivers/mfd/m4sensorhub-stm32-fw.c index 55aca3ebb05..30fe52ef6ff 100644 --- a/drivers/mfd/m4sensorhub-stm32-fw.c +++ b/drivers/mfd/m4sensorhub-stm32-fw.c @@ -27,8 +27,6 @@  static int m4sensorhub_jump_to_user(struct m4sensorhub_data *m4sensorhub);  /* --------------- Local Declarations -------------- */ -/* Firmware */ -#define FIRMWARE_NAME	"m4sensorhub.bin"  /* The M4 Flash Memory Map   * From the Flash Programming Manual:    Sector  Start Address    Size              comments @@ -126,11 +124,11 @@ int m4sensorhub_load_firmware(struct m4sensorhub_data *m4sensorhub,  		goto done;  	} -	ret = request_firmware(&firmware, FIRMWARE_NAME, +	ret = request_firmware(&firmware, m4sensorhub->filename,  		&m4sensorhub->i2c_client->dev);  	if (ret < 0) {  		KDEBUG(M4SH_ERROR, "%s: request_firmware failed for %s\n", -			__func__, FIRMWARE_NAME); +			__func__,  m4sensorhub->filename);  		KDEBUG(M4SH_ERROR, "Trying to run firmware already on hw.\n");  		ret = 0;  		goto done; diff --git a/include/linux/m4sensorhub.h b/include/linux/m4sensorhub.h index c9a14917011..266f2742d89 100644 --- a/include/linux/m4sensorhub.h +++ b/include/linux/m4sensorhub.h @@ -106,6 +106,7 @@ struct m4sensorhub_data {  	enum m4sensorhub_mode mode;  	struct m4sensorhub_platform_data *pdev;  	struct m4sensorhub_hwconfig hwconfig; +	char *filename;  };  /* Global (kernel) functions */  |