changeset 943:f22b34873ea5

gsm-fw: feature pirhack-ffs changed to feature aftermarket-ffs, now supports Compal as well
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 01 Nov 2015 03:39:51 +0000
parents 042c178ebac5
children 51f580665110
files gsm-fw/cfgmagic/feature.aftermarket-ffs gsm-fw/cfgmagic/feature.pirhack-ffs gsm-fw/cfgmagic/target.c139 gsm-fw/cfgmagic/target.c155 gsm-fw/cfgmagic/target.pirelli gsm-fw/services/ffs/cfgffs.c
diffstat 6 files changed, 66 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/cfgmagic/feature.aftermarket-ffs	Sun Nov 01 03:39:51 2015 +0000
@@ -0,0 +1,38 @@
+# This feature is specific to Compal and Pirelli targets.  When we put our own
+# FreeCalypso firmware on these phones, we are using them in a way that is very
+# different from how they were intended to be used by their respective
+# manufacturers.  Hence the term "aftermarket".  Although the original firmwares
+# of these phones are TI-based and feature TI-based flash file systems, neither
+# Pirelli's FFS nor that of any Compal variant is suitable for direct reuse by
+# FreeCalypso GSM fw.
+#
+# Therefore, if we are putting our own fw on one of these aftermarket devices
+# and we need to use a real non-volatile FFS in flash, rather than fake FFS
+# in RAM, we need to define our own aftermarket FFS, and we can put it in any
+# part of the flash that suits our needs, without much regard for Compal's or
+# Foxconn's originally intended flash layout - what we are doing with their
+# hardware goes totally against their intentions anyway.
+#
+# Because our aftermarket FFS configuration inherently involves our own choice
+# of flash location for this FFS, the present feature aftermarket-ffs takes two
+# required arguments: the starting flash sector number and the total number of
+# flash sectors to be used for the aftermarket FFS.  It is the user's
+# responsibility to ensure that these numbers are sensible.
+
+check_target_feature "$1"
+
+if [ $# != 3 ]
+then
+	echo "feature aftermarket-ffs: two arguments required" 1>&2
+	exit 1
+fi
+
+FFS_IN_RAM=0
+CONFIG_AFTERMARKET_FFS=1
+CONFIG_AFTERMARKET_FFS_START=$2
+CONFIG_AFTERMARKET_FFS_NBLOCKS=$3
+CONFIG_FLASH_WRITE=1
+export_to_c	CONFIG_AFTERMARKET_FFS
+export_to_c	CONFIG_AFTERMARKET_FFS_START
+export_to_c	CONFIG_AFTERMARKET_FFS_NBLOCKS
+export_to_c	CONFIG_FLASH_WRITE
--- a/gsm-fw/cfgmagic/feature.pirhack-ffs	Sun Nov 01 03:05:06 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-# Concerning the FFS, there is one fundamental difference between the gtamodem
-# and pirelli targets: whereas the content of Openmoko's modem FFS is directly
-# fit for reuse by our fw (resulting from the phylogenetic proximity of the two
-# firmwares), Pirelli's original FFS has the same format, but its content is so
-# different that trying to reuse it would be more trouble than it is worth.
-# (And Pirelli's FFS contains no IMEI or RF calibration data to boot!)
-#
-# Therefore, I (FC developer Space Falcon) have decided that when targeting the
-# Pirelli, it would be better for us to start from our own blank FFS than to
-# deal with the original.  However, because there is no single correct answer
-# as to which region of the flash chip we should use (other than needing to be
-# in the flash2 bank so we can use the more efficient multibank flash driver),
-# this feature pirhack-ffs takes two required arguments: the number of the
-# first flash2 sector to be used for the FFS and the total number of sectors
-# to be used.  For example, this setting:
-#
-# feature pirhack-ffs 24 7
-#
-# will configure our GSM fw to put its FFS in the last 7 256 KiB sectors of the
-# 2nd flash chip select, which coincidentally form an independent read/write
-# bank, and are part of the flash2 region which appears to be "unused" by the
-# original firmware.  Or you can use all of this "unused" area like this:
-#
-# feature pirhack-ffs 18 13
-#
-# The sum of the two numbers must not exceed 31, i.e., the end of our FFS must
-# be at or before the end of the "large sectors" main part of flash2.
-# Specifying feature pirhack-ffs 0 18 will make our FFS use the same sectors
-# as the original, but attempting to reuse the original FFS without reformatting
-# is NOT recommended or supported.
-
-check_target_feature "$1"
-
-if [ $# != 3 ]
-then
-	echo "feature pirhack-ffs: two arguments required" 1>&2
-	exit 1
-fi
-
-FFS_IN_RAM=0
-CONFIG_PIRHACK_FFS=1
-CONFIG_PIRHACK_FFS_START=$2
-CONFIG_PIRHACK_FFS_NBLOCKS=$3
-CONFIG_FLASH_WRITE=1
-export_to_c	CONFIG_PIRHACK_FFS
-export_to_c	CONFIG_PIRHACK_FFS_START
-export_to_c	CONFIG_PIRHACK_FFS_NBLOCKS
-export_to_c	CONFIG_FLASH_WRITE
--- a/gsm-fw/cfgmagic/target.c139	Sun Nov 01 03:05:06 2015 +0000
+++ b/gsm-fw/cfgmagic/target.c139	Sun Nov 01 03:39:51 2015 +0000
@@ -33,3 +33,5 @@
 export_to_c	USE_TSPACT2_FOR_TXLOW
 
 RVTMUX_UART_port=MODEM
+
+allow_target_feature	aftermarket-ffs
--- a/gsm-fw/cfgmagic/target.c155	Sun Nov 01 03:05:06 2015 +0000
+++ b/gsm-fw/cfgmagic/target.c155	Sun Nov 01 03:39:51 2015 +0000
@@ -33,3 +33,5 @@
 export_to_c	USE_TSPACT2_FOR_TXLOW
 
 RVTMUX_UART_port=MODEM
+
+allow_target_feature	aftermarket-ffs
--- a/gsm-fw/cfgmagic/target.pirelli	Sun Nov 01 03:05:06 2015 +0000
+++ b/gsm-fw/cfgmagic/target.pirelli	Sun Nov 01 03:39:51 2015 +0000
@@ -28,4 +28,4 @@
 # The best we can do for now is lie and pretend to be Leonardo/Openmoko.
 RF_PA=2
 
-allow_target_feature	pirhack-ffs
+allow_target_feature	aftermarket-ffs
--- a/gsm-fw/services/ffs/cfgffs.c	Sun Nov 01 03:05:06 2015 +0000
+++ b/gsm-fw/services/ffs/cfgffs.c	Sun Nov 01 03:39:51 2015 +0000
@@ -37,22 +37,41 @@
     .numblocks	   = 7,
 };
 
-#elif CONFIG_PIRHACK_FFS
+#elif CONFIG_AFTERMARKET_FFS
+
+/* see ../../cfgmagic/feature.aftermarket-ffs */
+
+#if CONFIG_TARGET_COMPAL
 
-/* see ../../cfgmagic/feature.pirhack-ffs */
+struct dev_s dev = {
+    .base	   = (char *) (CONFIG_AFTERMARKET_FFS_START * 0x10000),
+    .manufact	   = MANUFACT_INTEL,
+    .blocksize	   = 0x10000,
+    .blocksize_ld  = 16,
+    .driver	   = FFS_DRIVER_INTEL_SB,
+    .numblocks	   = CONFIG_AFTERMARKET_FFS_NBLOCKS,
+};
+
+#elif CONFIG_TARGET_PIRELLI
 
 struct dev_s dev = {
     .base	   = (char *) FLASH2_BASE_ADDR +
-				CONFIG_PIRHACK_FFS_START * 0x40000,
+				CONFIG_AFTERMARKET_FFS_START * 0x40000,
     .manufact	   = MANUFACT_AMD,
     .blocksize	   = 0x40000,
     .blocksize_ld  = 18,
     .driver	   = FFS_DRIVER_AMD,
-    .numblocks	   = CONFIG_PIRHACK_FFS_NBLOCKS,
+    .numblocks	   = CONFIG_AFTERMARKET_FFS_NBLOCKS,
 };
 
 #else
 
+#error "Unknown target for CONFIG_AFTERMARKET_FFS"
+
+#endif
+
+#else
+
 #error "No valid FFS configuration defined"
 
 #endif