diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-02 12:17:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-08-02 12:17:57 +0200 |
commit | 2c36d3842c83b21e0e15b79d3703b4df30bb202d (patch) | |
tree | 7cb6ce9530054724ad2e9061f5067b1db24c16ba | |
parent | 97c2296ca448500e1a09b9bb03483659fb8543f8 (diff) | |
download | sdma-firmware-2c36d3842c83b21e0e15b79d3703b4df30bb202d.tar.gz sdma-firmware-2c36d3842c83b21e0e15b79d3703b4df30bb202d.tar.xz |
add i.MX51/25 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | imx25-v1.c | 115 | ||||
-rw-r--r-- | imx51-v1.c | 115 | ||||
-rw-r--r-- | sdma-firmware.h | 12 | ||||
-rw-r--r-- | sdma-gen-image.c | 44 |
5 files changed, 284 insertions, 13 deletions
@@ -1,5 +1,12 @@ -all: sdma-gen-image +FIRMWARE=sdma-imx31-to1.bin sdma-imx31-to2.bin sdma-imx35-to1.bin sdma-imx35-to2.bin sdma-imx51-to1.bin sdma-imx25-to1.bin -sdma-gen-image: imx31-v1.o imx31-v2.o imx35-v1.o imx35-v2.o sdma-gen-image.o +all: $(FIRMWARE) + @./sdma-gen-image +$(FIRMWARE): sdma-gen-image + +sdma-gen-image: imx31-v1.o imx31-v2.o imx35-v1.o imx35-v2.o imx51-v1.o imx25-v1.o sdma-gen-image.o + +clean: + @rm -f *.o *.bin diff --git a/imx25-v1.c b/imx25-v1.c new file mode 100644 index 0000000..53f9ced --- /dev/null +++ b/imx25-v1.c @@ -0,0 +1,115 @@ +/* + * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. + * + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include "sdma-firmware.h" + +static const short blob[] = { + 0x0e70, 0x0611, 0x5616, 0xc18a, 0x7d2a, 0x5ade, 0x008e, 0xc19c, + 0x7c26, 0x5be0, 0x5ef0, 0x5ce8, 0x0688, 0x08ff, 0x0011, 0x28ff, + 0x00bc, 0x53f6, 0x05df, 0x7d0b, 0x6dc5, 0x03df, 0x7d03, 0x6bd5, + 0xd84f, 0x982b, 0x6b05, 0xc6d8, 0x7e27, 0x7f29, 0x982b, 0x6d01, + 0x03df, 0x7d05, 0x6bd5, 0xc702, 0x7e18, 0x7f1a, 0x982b, 0x6b05, + 0xc678, 0x7e07, 0x7f06, 0x52de, 0x53e6, 0xc1a8, 0x7dd7, 0x0200, + 0x9803, 0x0007, 0x6004, 0x680c, 0x53f6, 0x028e, 0x00a3, 0xc2ad, + 0x048b, 0x0498, 0x0454, 0x068a, 0x982b, 0x0207, 0x680c, 0x6ddf, + 0x0107, 0x68ff, 0x60d0, 0x9834, 0x0207, 0x68ff, 0x6d28, 0x0107, + 0x6004, 0x680c, 0x9834, 0x0007, 0x68ff, 0x60d0, 0x9834, 0x0288, + 0x03a5, 0x3b03, 0x3d03, 0x4d00, 0x7d0a, 0x0804, 0x00a5, 0x00da, + 0x7d1a, 0x02a0, 0x7b01, 0x65d8, 0x7eee, 0x65ff, 0x7eec, 0x0804, + 0x02d0, 0x7d11, 0x4b00, 0x7c0f, 0x008a, 0x3003, 0x6dcf, 0x6bdf, + 0x0015, 0x0015, 0x7b02, 0x65d8, 0x0000, 0x7edd, 0x63ff, 0x7edb, + 0x3a03, 0x6dcd, 0x6bdd, 0x008a, 0x7b02, 0x65d8, 0x0000, 0x7ed3, + 0x65ff, 0x7ed1, 0x0006, 0xc23a, 0x57db, 0x52f3, 0x6ad5, 0x56fb, + 0x028e, 0x1a94, 0x6ac3, 0x62c8, 0x0269, 0x7d1e, 0x1e94, 0x6ee3, + 0x62d0, 0x5aeb, 0x62c8, 0x0248, 0x6ed3, 0x6ac8, 0x2694, 0x52eb, + 0x6ad5, 0x6ee3, 0x62c8, 0x026e, 0x7d27, 0x6ac8, 0x7f23, 0x2501, + 0x4d00, 0x7d26, 0x028e, 0x1a98, 0x6ac3, 0x62c8, 0x6ec3, 0x0260, + 0x7df1, 0x62d0, 0xc2d1, 0x98c0, 0x6ee3, 0x008f, 0x2001, 0x00d5, + 0x7d01, 0x008d, 0x05a0, 0x62c8, 0x026e, 0x7d0e, 0x6ac8, 0x7f0a, + 0x2001, 0x7cf9, 0x6add, 0x7f06, 0x0000, 0x4d00, 0x7d09, 0xc251, + 0x57db, 0x987f, 0x0007, 0x6aff, 0x62d0, 0xc2d1, 0x0458, 0x0454, + 0x6add, 0x7ff8, 0xc261, 0x987c, 0xc230, 0xc23a, 0x57db, 0x52f3, + 0x6ad5, 0x56fb, 0x028e, 0x1a94, 0x5202, 0x0269, 0x7d17, 0x1e94, + 0x5206, 0x0248, 0x5a06, 0x2694, 0x5206, 0x026e, 0x7d26, 0x6ac8, + 0x7f22, 0x2501, 0x4d00, 0x7d27, 0x028e, 0x1a98, 0x5202, 0x0260, + 0x7df3, 0x6add, 0x7f18, 0x62d0, 0xc2d1, 0x9903, 0x008f, 0x2001, + 0x00d5, 0x7d01, 0x008d, 0x05a0, 0x5206, 0x026e, 0x7d0e, 0x6ac8, + 0x7f0a, 0x2001, 0x7cf9, 0x6add, 0x7f06, 0x0000, 0x4d00, 0x7d0b, + 0xc251, 0x57db, 0x98c9, 0x0007, 0x6aff, 0x6add, 0x7ffc, 0x62d0, + 0xc2d1, 0x0458, 0x0454, 0x6add, 0x7ff6, 0xc261, 0x98c6, +}; + +#define start_ADDR 0 +#define core_ADDR 80 +#define common_ADDR 313 +#define loop_DMAs_routines_ADDR 1656 +#define test_ADDR 1883 +#define signature_ADDR 1022 +#define uartsh_2_per_ADDR 6340 + +/* + * SDMA ROM scripts start addresses and sizes + */ +static struct sdma_script_start_addrs addr = { + .ap_2_ap_addr = 729, + .ap_2_bp_addr = -1, + .bp_2_ap_addr = -1, + .loopback_on_dsp_side_addr = -1, + .mcu_interrupt_only_addr = -1, + + .firi_2_per_addr = -1, + .firi_2_mcu_addr = -1, + .per_2_firi_addr = -1, + .mcu_2_firi_addr = -1, + + .uart_2_per_addr = 6267, + .uart_2_mcu_addr = 904, + .per_2_app_addr = 1255, + .mcu_2_app_addr = 834, + + .per_2_per_addr = -1, + + .uartsh_2_per_addr = 6340, + .uartsh_2_mcu_addr = 1120, + .per_2_shp_addr = 1329, + .mcu_2_shp_addr = 1048, + + .ata_2_mcu_addr = 1560, + .mcu_2_ata_addr = 1479, + + .app_2_per_addr = 1189, + .app_2_mcu_addr = 770, + .shp_2_per_addr = 1407, + .shp_2_mcu_addr = 979, + + .mshc_2_mcu_addr = -1, + .mcu_2_mshc_addr = -1, + + .spdif_2_mcu_addr = -1, + .mcu_2_spdif_addr = -1, + + .asrc_2_mcu_addr = -1, + + .dptc_dvfs_addr = -1, + .ext_mem_2_ipu_addr = 6144, + .descrambler_addr = -1, + + .ram_code_start_addr = -1, +}; + +struct sdma_firmware sdma_imx25_v1 = { + .addr = &addr, + .blob = blob, + .blob_size = ARRAY_SIZE(blob), + .name = "sdma-imx25-to1", +}; + diff --git a/imx51-v1.c b/imx51-v1.c new file mode 100644 index 0000000..8a67524 --- /dev/null +++ b/imx51-v1.c @@ -0,0 +1,115 @@ +/* + * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. + * + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include "sdma-firmware.h" + +static const short blob[] = { + 0x0e70, 0x0611, 0x5616, 0xc13c, 0x7d2a, 0x5ade, 0x008e, 0xc14e, + 0x7c26, 0x5be0, 0x5ef0, 0x5ce8, 0x0688, 0x08ff, 0x0011, 0x28ff, + 0x00bc, 0x53f6, 0x05df, 0x7d0b, 0x6dc5, 0x03df, 0x7d03, 0x6bd5, + 0xd84f, 0x982b, 0x6b05, 0xc681, 0x7e27, 0x7f29, 0x982b, 0x6d01, + 0x03df, 0x7d05, 0x6bd5, 0xc6ab, 0x7e18, 0x7f1a, 0x982b, 0x6b05, + 0xc621, 0x7e07, 0x7f06, 0x52de, 0x53e6, 0xc159, 0x7dd7, 0x0200, + 0x9803, 0x0007, 0x6004, 0x680c, 0x53f6, 0x028e, 0x00a3, 0xc256, + 0x048b, 0x0498, 0x0454, 0x068a, 0x982b, 0x0207, 0x680c, 0x6ddf, + 0x0107, 0x68ff, 0x60d0, 0x9834, 0x0207, 0x68ff, 0x6d28, 0x0107, + 0x6004, 0x680c, 0x9834, 0x0007, 0x68ff, 0x60d0, 0x9834, 0x0288, + 0x03a5, 0x3b03, 0x3d03, 0x4d00, 0x7d0a, 0x0804, 0x00a5, 0x00da, + 0x7d1a, 0x02a0, 0x7b01, 0x65d8, 0x7eee, 0x65ff, 0x7eec, 0x0804, + 0x02d0, 0x7d11, 0x4b00, 0x7c0f, 0x008a, 0x3003, 0x6dcf, 0x6bdf, + 0x0015, 0x0015, 0x7b02, 0x65d8, 0x0000, 0x7edd, 0x63ff, 0x7edb, + 0x3a03, 0x6dcd, 0x6bdd, 0x008a, 0x7b02, 0x65d8, 0x0000, 0x7ed3, + 0x65ff, 0x7ed1, 0x0006, 0xc1d9, 0xc1e3, 0x57db, 0x52f3, 0x6a01, + 0x008f, 0x00d5, 0x7d01, 0x008d, 0x05a0, 0x5deb, 0x56fb, 0x0478, + 0x7d28, 0x0479, 0x7c16, 0x0015, 0x0015, 0x0388, 0x620a, 0x0808, + 0x7801, 0x0217, 0x5a06, 0x7f1d, 0x620a, 0x0808, 0x7801, 0x0217, + 0x5a26, 0x7f17, 0x2301, 0x4b00, 0x7cf1, 0x0b70, 0x0311, 0x5313, + 0x98aa, 0x0015, 0x0015, 0x0015, 0x7804, 0x620b, 0x5a06, 0x620b, + 0x5a26, 0x7c07, 0x0000, 0x55eb, 0x4d00, 0x7d06, 0xc1fa, 0x57db, + 0x9880, 0x0007, 0x680c, 0xc213, 0xc20a, 0x987d, 0xc1e3, 0x57db, + 0x52f3, 0x6ad5, 0x56fb, 0x028e, 0x1a94, 0x6ac3, 0x62c8, 0x0269, + 0x7d1e, 0x1e94, 0x6ee3, 0x62d0, 0x5aeb, 0x62c8, 0x0248, 0x6ed3, + 0x6ac8, 0x2694, 0x52eb, 0x6ad5, 0x6ee3, 0x62c8, 0x026e, 0x7d27, + 0x6ac8, 0x7f23, 0x2501, 0x4d00, 0x7d26, 0x028e, 0x1a98, 0x6ac3, + 0x62c8, 0x6ec3, 0x0260, 0x7df1, 0x62d0, 0xc27a, 0x98fb, 0x6ee3, + 0x008f, 0x2001, 0x00d5, 0x7d01, 0x008d, 0x05a0, 0x62c8, 0x026e, + 0x7d0e, 0x6ac8, 0x7f0a, 0x2001, 0x7cf9, 0x6add, 0x7f06, 0x0000, + 0x4d00, 0x7d09, 0xc1fa, 0x57db, 0x98ba, 0x0007, 0x6aff, 0x62d0, + 0xc27a, 0x0458, 0x0454, 0x6add, 0x7ff8, 0xc20a, 0x98b7, 0xc1d9, + 0xc1e3, 0x57db, 0x52f3, 0x6ad5, 0x56fb, 0x028e, 0x1a94, 0x5202, + 0x0269, 0x7d17, 0x1e94, 0x5206, 0x0248, 0x5a06, 0x2694, 0x5206, + 0x026e, 0x7d26, 0x6ac8, 0x7f22, 0x2501, 0x4d00, 0x7d27, 0x028e, + 0x1a98, 0x5202, 0x0260, 0x7df3, 0x6add, 0x7f18, 0x62d0, 0xc27a, + 0x993e, 0x008f, 0x2001, 0x00d5, 0x7d01, 0x008d, 0x05a0, 0x5206, + 0x026e, 0x7d0e, 0x6ac8, 0x7f0a, 0x2001, 0x7cf9, 0x6add, 0x7f06, + 0x0000, 0x4d00, 0x7d0b, 0xc1fa, 0x57db, 0x9904, 0x0007, 0x6aff, + 0x6add, 0x7ffc, 0x62d0, 0xc27a, 0x0458, 0x0454, 0x6add, 0x7ff6, + 0xc20a, 0x9901, +}; + +/* + * SDMA ROM scripts start addresses and sizes + */ +static struct sdma_script_start_addrs addr = { + .ap_2_ap_addr = 642, + .ap_2_bp_addr = -1, + .bp_2_ap_addr = -1, + .loopback_on_dsp_side_addr = -1, + .mcu_interrupt_only_addr = -1, + + .firi_2_per_addr = -1, + .firi_2_mcu_addr = -1, + .per_2_firi_addr = -1, + .mcu_2_firi_addr = -1, + + .uart_2_per_addr = 6326, + .uart_2_mcu_addr = 817, + .per_2_app_addr = 1099, + .mcu_2_app_addr = 747, + + .per_2_per_addr = -1, + + .uartsh_2_per_addr = 6399, + .uartsh_2_mcu_addr = 1323, + .per_2_shp_addr = 1173, + .mcu_2_shp_addr = 961, + + .ata_2_mcu_addr = 1473, + .mcu_2_ata_addr = 1392, + + .app_2_per_addr = 1033, + .app_2_mcu_addr = 683, + .shp_2_per_addr = 1251, + .shp_2_mcu_addr = 892, + + .mshc_2_mcu_addr = -1, + .mcu_2_mshc_addr = -1, + + .spdif_2_mcu_addr = -1, + .mcu_2_spdif_addr = 6267, + + .asrc_2_mcu_addr = -1, + + .dptc_dvfs_addr = -1, + .ext_mem_2_ipu_addr = 6144, + .descrambler_addr = -1, + + .ram_code_start_addr = -1, +}; + +struct sdma_firmware sdma_imx51_v1 = { + .addr = &addr, + .blob = blob, + .blob_size = ARRAY_SIZE(blob), + .name = "sdma-imx51-to1", +}; + diff --git a/sdma-firmware.h b/sdma-firmware.h index 5e5ede9..84e14dc 100644 --- a/sdma-firmware.h +++ b/sdma-firmware.h @@ -11,6 +11,14 @@ struct sdma_firmware_header { uint32_t ram_code_size; /* size of SDMA ram image */ }; +/* + * This describes the start addresses of the different entries + * in the binary image. This structure is assumed to only grow + * but never change its format. Whenever this structure grows + * version_major above is counted up, thus it's possible to + * combine newer versions of this structure with older kernels + * and vice versa. + */ struct sdma_script_start_addrs { uint32_t ap_2_ap_addr; uint32_t ap_2_bp_addr; @@ -70,10 +78,14 @@ struct sdma_firmware { char *name; }; +extern struct sdma_firmware sdma_imx25_v1; extern struct sdma_firmware sdma_imx31_v1; extern struct sdma_firmware sdma_imx31_v2; extern struct sdma_firmware sdma_imx35_v1; extern struct sdma_firmware sdma_imx35_v2; +extern struct sdma_firmware sdma_imx51_v1; #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#define SDMA_FIRMWARE_MAGIC 0x414d4453 /* "SDMA" */ + diff --git a/sdma-gen-image.c b/sdma-gen-image.c index a63e669..848b312 100644 --- a/sdma-gen-image.c +++ b/sdma-gen-image.c @@ -1,18 +1,40 @@ +/* + * sdma-gen-image - generate Freescale i.MX SDMA firmware images suitable + * for Linux + * + * Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> +#include <endian.h> #include "sdma-firmware.h" - static struct sdma_firmware *firmwares[] = { + &sdma_imx25_v1, &sdma_imx31_v1, &sdma_imx31_v2, &sdma_imx35_v1, &sdma_imx35_v2, + &sdma_imx51_v1, }; static int gen_one(struct sdma_firmware *fw) @@ -22,20 +44,20 @@ static int gen_one(struct sdma_firmware *fw) char *name; FILE *f; - printf("name: %s %d\n", fw->name); - - header.magic = 0x414d4453; - header.version_major = 1; - header.version_minor = fw->version; - header.script_addrs_start = sizeof(header); - header.num_script_addrs = sizeof(struct sdma_script_start_addrs) / sizeof(uint32_t); - header.ram_code_start = header.script_addrs_start + sizeof(struct sdma_script_start_addrs); - header.ram_code_size = fw->blob_size * sizeof(uint16_t); - ret = asprintf(&name, "%s.bin", fw->name); if (ret < 0) return ret; + printf("generating %s\n", name); + + header.magic = htole32(SDMA_FIRMWARE_MAGIC); + header.version_major = htole32(1); + header.version_minor = htole32(fw->version); + header.script_addrs_start = htole32(sizeof(header)); + header.num_script_addrs = htole32(sizeof(struct sdma_script_start_addrs) / sizeof(uint32_t)); + header.ram_code_start = htole32(header.script_addrs_start + sizeof(struct sdma_script_start_addrs)); + header.ram_code_size = htole32(fw->blob_size * sizeof(uint16_t)); + f = fopen(name, "w"); if (!f) { perror("fopen"); |