Patchwork [3/5] am33x-cm3: add FW for suspend/resume

login
register
mail settings
Submitter Anders Darander
Date May 9, 2013, 8:31 p.m.
Message ID <1368131491-14115-4-git-send-email-anders.darander@gmail.com>
Download mbox | patch
Permalink /patch/242837/
State Superseded
Headers show

Comments

Anders Darander - May 9, 2013, 8:31 p.m.
From: Anders Darander <anders@chargestorm.se>

Without this firmware, the beaglebone won't be able to reboot correctly.

Signed-off-by: Anders Darander <anders@chargestorm.se>
---
 package/Config.in                         |    1 +
 package/am33x-cm3/Config.in               |    4 ++++
 package/am33x-cm3/am335x-pm-firmware-load |    6 ++++++
 package/am33x-cm3/am33x-cm3.mk            |   26 ++++++++++++++++++++++++++
 4 files changed, 37 insertions(+)
 create mode 100644 package/am33x-cm3/Config.in
 create mode 100755 package/am33x-cm3/am335x-pm-firmware-load
 create mode 100644 package/am33x-cm3/am33x-cm3.mk
Arnout Vandecappelle - May 10, 2013, 10:56 p.m.
On 09/05/13 22:31, Anders Darander wrote:
> From: Anders Darander <anders@chargestorm.se>
>
> Without this firmware, the beaglebone won't be able to reboot correctly.
>
> Signed-off-by: Anders Darander <anders@chargestorm.se>
[snip]
> diff --git a/package/am33x-cm3/am33x-cm3.mk b/package/am33x-cm3/am33x-cm3.mk
> new file mode 100644
> index 0000000..6180157
> --- /dev/null
> +++ b/package/am33x-cm3/am33x-cm3.mk
> @@ -0,0 +1,26 @@
> +#############################################################
> +#
> +# am33x-cm3
> +#
> +#############################################################
> +
> +# SHA1 corresponds to tag "AM335xPSP_04.06.00.10-rc1"
> +AM33X_CM3_VERSION = 27ca4643e422245a95723de1df0247a00eada45b

  If it is a tag, then use the tag, not the sha1.

> +AM33X_CM3_SITE = git://arago-project.org/git/projects/am33x-cm3.git
> +AM33X_CM3_METHOD = git

  Since the site starts with git://, the method is git by default. 
However, if the site supports http, we prefer to use that. Some company 
firewalls block git.

> +AM33X_CM3_LICENSE = TI-BSD

  I don't really like this license name. Either it's BSD (then it should 
specify 2-, 3- or 4-clause), or it is not. In the latter case, it would 
be something like "TI Open Source license (BSD-like)".

> +AM33X_CM3_LICENSE_FILES = License.txt
> +
> +define AM33X_CM3_BUILD_CMDS
> +	$(MAKE) CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) all

  Does it work with $(TARGET_CONFIGURE_OPTS) instead of CC=? If not, then 
please also pass the CFLAGS and LDFLAGS - they may be important.

  However, now I think about it - this is abusing the cross-compiler for 
the Cortex-A8 to generate code for the Cortex-M3, correct? In that case, 
passing CFLAGS and LDFLAGS is probably not a good idea. But it would also 
be good to add a note about what is happening here.

> +endef
> +
> +# Not all of the firmware files are used
> +define AM33X_CM3_INSTALL_TARGET_CMDS
> +	$(INSTALL) -d -m 0755 $(TARGET_DIR)/lib/firmware/
> +	$(INSTALL) -m 0644 $(@D)/bin/am335x-pm-firmware.bin $(TARGET_DIR)/lib/firmware

  We normally create directories with the -D option to install, so:

	$(INSTALL) -m 0644 -D  $(@D)/bin/am335x-pm-firmware.bin \
		$(TARGET_DIR)/lib/firmware/am335x-pm-firmware.bin

> +	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d
> +	$(INSTALL) -m 0755 package/am33x-cm3/am335x-pm-firmware-load $(TARGET_DIR)/etc/init.d/S93-am335x-pm-firwmare-load

  init scripts are installed by a separate variable, 
AM33X_CM3_INSTALL_INIT_SYSV. And of course, the same remark about the -D 
option applies.


  Regards,
  Arnout

> +endef
> +
> +$(eval $(generic-package))
>

Patch

diff --git a/package/Config.in b/package/Config.in
index d980871..329d734 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -213,6 +213,7 @@  endmenu
 
 menu "Hardware handling"
 menu "Misc devices firmwares"
+source "package/am33x-cm3/Config.in"
 source "package/b43-firmware/Config.in"
 source "package/firmware-imx/Config.in"
 source "package/linux-firmware/Config.in"
diff --git a/package/am33x-cm3/Config.in b/package/am33x-cm3/Config.in
new file mode 100644
index 0000000..ee39f7d
--- /dev/null
+++ b/package/am33x-cm3/Config.in
@@ -0,0 +1,4 @@ 
+config BR2_PACKAGE_AM33X_CM3
+	bool "am33x-cm3"
+	help
+	  Cortex-M3 binary blob for suspend-resume
diff --git a/package/am33x-cm3/am335x-pm-firmware-load b/package/am33x-cm3/am335x-pm-firmware-load
new file mode 100755
index 0000000..56c17b3
--- /dev/null
+++ b/package/am33x-cm3/am335x-pm-firmware-load
@@ -0,0 +1,6 @@ 
+#!/bin/sh
+
+# Load the PM CM3 firmware
+echo 1 > /sys/devices/ocp.2/44d00000.wkup_m3/firmware/am335x-pm-firmware.bin/loading
+cat /lib/firmware/am335x-pm-firmware.bin > /sys/devices/ocp.2/44d00000.wkup_m3/firmware/am335x-pm-firmware.bin/data
+echo 0 > /sys/devices/ocp.2/44d00000.wkup_m3/firmware/am335x-pm-firmware.bin/loading
diff --git a/package/am33x-cm3/am33x-cm3.mk b/package/am33x-cm3/am33x-cm3.mk
new file mode 100644
index 0000000..6180157
--- /dev/null
+++ b/package/am33x-cm3/am33x-cm3.mk
@@ -0,0 +1,26 @@ 
+#############################################################
+#
+# am33x-cm3
+#
+#############################################################
+
+# SHA1 corresponds to tag "AM335xPSP_04.06.00.10-rc1"
+AM33X_CM3_VERSION = 27ca4643e422245a95723de1df0247a00eada45b
+AM33X_CM3_SITE = git://arago-project.org/git/projects/am33x-cm3.git
+AM33X_CM3_METHOD = git
+AM33X_CM3_LICENSE = TI-BSD
+AM33X_CM3_LICENSE_FILES = License.txt
+
+define AM33X_CM3_BUILD_CMDS
+	$(MAKE) CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)" -C $(@D) all
+endef
+
+# Not all of the firmware files are used
+define AM33X_CM3_INSTALL_TARGET_CMDS
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/lib/firmware/
+	$(INSTALL) -m 0644 $(@D)/bin/am335x-pm-firmware.bin $(TARGET_DIR)/lib/firmware
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d
+	$(INSTALL) -m 0755 package/am33x-cm3/am335x-pm-firmware-load $(TARGET_DIR)/etc/init.d/S93-am335x-pm-firwmare-load
+endef
+
+$(eval $(generic-package))