Skip to contentSkip to conversation

ARM: add support for Canon DIGIC chips and Canon PowerShot A1100 IS

PATCH Applied Antony Pavlov 2 participants 13 messages Jul 28, 2014 – Jul 29, 2014

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: add support for Canon DIGIC chips and Canon PowerShot A1100 IS

Changes since v1:

* fix reset_cpu();
* add real Canon A1100 camera support.

DIGIC is Canon Inc.'s name for a family of SoC for digital cameras and camcorders.

See http://en.wikipedia.org/wiki/DIGIC for details.

There is no publicly available specification for DIGIC chips. All information about DIGIC chip internals is based on reverse engineering efforts made by CHDK (http://chdk.wikia.com) and Magic Lantern (http://www.magiclantern.fm) projects contributors.

Also this patch series adds initial support for Canon PowerShot A1100 IS compact camera (it is my only camera with connected UART interface). As the DIGIC-based cameras differences mostly are unsignificant (e.g. RAM-size, ROM type and size, GPIO usage) the other compact and DSLR cameras support can be easely added.

One can easely run barebox for Canon A1100 using QEMU version 2.0 or newer.

This patchseries uses some patches already submitted to maillist:

* clean barebox.zynq
* treewide: drop Doxygen stuff

Antony Pavlov (11):
ARM: add ARM946E-S CPU type
ARM: add very initial support for Canon DIGIC chips
clocksource: add driver for Canon DIGIC timer
serial: add driver for Canon DIGIC UART
gpio: add driver for Canon DIGIC
ARM: DIGIC: add Canon PowerShot A1100 IS support
ARM: add Canon A1100 ROM image generation
ARM: DIGIC: add canon-a1100_defconfig
Documentation: add QEMU Canon A1100 barebox mini-howto
ARM: add Canon A1100 DISKBOOT.BIN image generation stuff
Documentation: add real Canon A1100 camera barebox mini-howto

 .gitignore                                  |   2 +
 Documentation/boards/digic.rst              |  69 +++++++++++
 Makefile                                    |   2 +-
 arch/arm/Kconfig                            |  10 ++
 arch/arm/Makefile                           |  17 +++
 arch/arm/boards/Makefile                    |   1 +
 arch/arm/boards/canon-a1100/Makefile        |   1 +
 arch/arm/boards/canon-a1100/lowlevel.c      |  23 ++++
 arch/arm/configs/canon-a1100_defconfig      |  56 +++++++++
 arch/arm/cpu/Kconfig                        |  13 ++
 arch/arm/dts/canon-a1100.dts                |  35 ++++++
 arch/arm/dts/digic4.dtsi                    |  42 +++++++
 arch/arm/mach-digic/Kconfig                 |  15 +++
 arch/arm/mach-digic/Makefile                |   1 +
 arch/arm/mach-digic/core.c                  |  25 ++++
 arch/arm/mach-digic/include/mach/debug_ll.h |  40 +++++++
 arch/arm/mach-digic/include/mach/digic4.h   |  23 ++++
 arch/arm/mach-digic/include/mach/uart.h     |  28 +++++
 drivers/clocksource/Kconfig                 |   4 +
 drivers/clocksource/Makefile                |   1 +
 drivers/clocksource/digic.c                 |  93 ++++++++++++++
 drivers/gpio/Kconfig                        |   4 +
 drivers/gpio/Makefile                       |   1 +
 drivers/gpio/gpio-digic.c                   | 180 ++++++++++++++++++++++++++++
 drivers/serial/Kconfig                      |   4 +
 drivers/serial/Makefile                     |   1 +
 drivers/serial/serial_digic.c               | 132 ++++++++++++++++++++
 scripts/.gitignore                          |   1 +
 scripts/Makefile                            |   1 +
 scripts/canon-a1100-image                   |  10 ++
 scripts/dancingbits.c                       |  77 ++++++++++++
 scripts/dancingbits.h                       |  20 ++++
 scripts/mkdiskboot                          |  13 ++
 33 files changed, 944 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/boards/digic.rst
 create mode 100644 arch/arm/boards/canon-a1100/Makefile
 create mode 100644 arch/arm/boards/canon-a1100/lowlevel.c
 create mode 100644 arch/arm/configs/canon-a1100_defconfig
 create mode 100644 arch/arm/dts/canon-a1100.dts
 create mode 100644 arch/arm/dts/digic4.dtsi
 create mode 100644 arch/arm/mach-digic/Kconfig
 create mode 100644 arch/arm/mach-digic/Makefile
 create mode 100644 arch/arm/mach-digic/core.c
 create mode 100644 arch/arm/mach-digic/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-digic/include/mach/digic4.h
 create mode 100644 arch/arm/mach-digic/include/mach/uart.h
 create mode 100644 drivers/clocksource/digic.c
 create mode 100644 drivers/gpio/gpio-digic.c
 create mode 100644 drivers/serial/serial_digic.c
 create mode 100755 scripts/canon-a1100-image
 create mode 100644 scripts/dancingbits.c
 create mode 100644 scripts/dancingbits.h
 create mode 100755 scripts/mkdiskboot
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/11 ARM: add ARM946E-S CPU type

ARM946E-S is used in the DIGIC family SoCs.

ARM946E-S core supports ARMv5TE and has Cache & MPU. Linux kernel uses ARMv4 MPU cache routines for ARM946E-S core. E.g. see linux.git/boot/compressed/head.S:

    .word   0x41009400              @ ARM94x
    .word   0xff00ff00
    W(b)    __armv4_mpu_cache_on
    W(b)    __armv4_mpu_cache_off
    W(b)    __armv4_mpu_cache_flush

So select CPU_32v4T for ARM946E-S despite of ARMv5TE support.

---
 arch/arm/cpu/Kconfig | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/cpu/Kconfig +13 -0
index aed4cb7..fb1a999 100644
@@ -39,6 +39,19 @@ config CPU_ARM926T
 	  Say Y if you want support for the ARM926T processor.
 	  Otherwise, say N.
 
+# ARM946E-S
+config CPU_ARM946E
+	bool
+	depends on !MMU
+	select CPU_32v4T
+	help
+	  ARM946E-S is a member of the ARM9E-S family of high-
+	  performance, 32-bit system-on-chip processor solutions.
+	  The TCM and ARMv5TE 32-bit instruction set is supported.
+
+	  Say Y if you want support for the ARM946E-S processor.
+	  Otherwise, say N.
+
 # Feroceon
 config CPU_FEROCEON
 	bool
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/11 ARM: add very initial support for Canon DIGIC chips

In reply to Antony Pavlov
---
 arch/arm/Kconfig                            | 10 +++++++
 arch/arm/Makefile                           |  1 +
 arch/arm/dts/digic4.dtsi                    | 42 +++++++++++++++++++++++++++++
 arch/arm/mach-digic/Kconfig                 |  8 ++++++
 arch/arm/mach-digic/Makefile                |  1 +
 arch/arm/mach-digic/core.c                  | 25 +++++++++++++++++
 arch/arm/mach-digic/include/mach/debug_ll.h | 40 +++++++++++++++++++++++++++
 arch/arm/mach-digic/include/mach/digic4.h   | 23 ++++++++++++++++
 arch/arm/mach-digic/include/mach/uart.h     | 28 +++++++++++++++++++
 9 files changed, 178 insertions(+)
arch/arm/Kconfig +10 -0
index 3af0197..ea0abcd 100644
@@ -62,6 +62,15 @@ config ARCH_DAVINCI
 	select HAS_DEBUG_LL
 	select GPIOLIB
 
+config ARCH_DIGIC
+	bool "Canon DIGIC-based cameras"
+	select CPU_ARM946E
+	select HAS_DEBUG_LL
+	select CLOCKSOURCE_DIGIC
+	select GPIOLIB
+	help
+	  Support for Canon's digital cameras that use the DIGIC4 chip.
+
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
 	select CPU_ARM920T
@@ -220,6 +229,7 @@ source arch/arm/mach-at91/Kconfig
 source arch/arm/mach-bcm2835/Kconfig
 source arch/arm/mach-clps711x/Kconfig
 source arch/arm/mach-davinci/Kconfig
+source arch/arm/mach-digic/Kconfig
 source arch/arm/mach-ep93xx/Kconfig
 source arch/arm/mach-highbank/Kconfig
 source arch/arm/mach-imx/Kconfig
arch/arm/Makefile +1 -0
index 983f7f5..1b0d7fe 100644
@@ -55,6 +55,7 @@ machine-$(CONFIG_ARCH_AT91)		:= at91
 machine-$(CONFIG_ARCH_BCM2835)		:= bcm2835
 machine-$(CONFIG_ARCH_CLPS711X)		:= clps711x
 machine-$(CONFIG_ARCH_DAVINCI)		:= davinci
+machine-$(CONFIG_ARCH_DIGIC)		:= digic
 machine-$(CONFIG_ARCH_EP93XX)		:= ep93xx
 machine-$(CONFIG_ARCH_HIGHBANK)		:= highbank
 machine-$(CONFIG_ARCH_IMX)		:= imx
arch/arm/dts/digic4.dtsi new file +42 -0

42 lines not on this page · raw message

arch/arm/mach-digic/Kconfig new file +8 -0
new file mode 100644
index 0000000..49ce44a
@@ -0,0 +1,8 @@
+if ARCH_DIGIC
+
+choice
+	prompt "camera type"
+
+endchoice
+
+endif
arch/arm/mach-digic/Makefile new file +1 -0
new file mode 100644
index 0000000..820eb10
@@ -0,0 +1 @@
+obj-y += core.o
arch/arm/mach-digic/core.c new file +25 -0
new file mode 100644
index 0000000..b1caec0
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ */
+
+#include <common.h>
+
+void __noreturn reset_cpu(unsigned long ignored)
+{
+	pr_err("%s: unimplemented\n", __func__);
+	hang();
+}
+EXPORT_SYMBOL(reset_cpu);
arch/arm/mach-digic/include/mach/debug_ll.h new file +40 -0
new file mode 100644
index 0000000..721fd44
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013, 2014 Antony Pavlov <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+#include <mach/digic4.h>
+#include <mach/uart.h>
+
+#define DEBUG_LL_UART         DIGIC4_UART
+
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + DIGIC_UART_TX)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + DIGIC_UART_ST)
+
+static inline void PUTC_LL(char ch)
+{
+	while (!(readl(DEBUG_LL_UART_ST) & DIGIC_UART_ST_TX_RDY))
+		; /* noop */
+
+	writel(0x06, DEBUG_LL_UART_ST);
+	writel(ch, DEBUG_LL_UART_TX);
+}
+
+#endif /* __MACH_DEBUG_LL_H__ */
arch/arm/mach-digic/include/mach/digic4.h new file +23 -0
new file mode 100644
index 0000000..ffc7979
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __DIGIC4_H__
+#define __DIGIC4_H__
+
+#define DIGIC4_UART	0xc0800000
+
+#endif /* __DIGIC4_H__ */
arch/arm/mach-digic/include/mach/uart.h new file +28 -0
new file mode 100644
index 0000000..043f7cd
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __DIGIC_UART_H__
+#define __DIGIC_UART_H__
+
+/* Serial interface registers offsets */
+#define DIGIC_UART_TX	0x0
+#define DIGIC_UART_RX	0x4
+#define DIGIC_UART_ST	0x14
+# define DIGIC_UART_ST_RX_RDY	1
+# define DIGIC_UART_ST_TX_RDY	2
+
+#endif /* __DIGIC_UART_H__ */
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/11 clocksource: add driver for Canon DIGIC timer

In reply to Antony Pavlov
---
 drivers/clocksource/Kconfig  |  4 ++
 drivers/clocksource/Makefile |  1 +
 drivers/clocksource/digic.c  | 93 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
drivers/clocksource/Kconfig +4 -0
index c1480ce..fc5a389 100644
@@ -14,6 +14,10 @@ config CLOCKSOURCE_CLPS711X
 	bool
 	depends on ARCH_CLPS711X
 
+config CLOCKSOURCE_DIGIC
+	bool
+	depends on ARCH_DIGIC
+
 config CLOCKSOURCE_DUMMY
 	bool "Enable dummy software-only clocksource"
 	help
drivers/clocksource/Makefile +1 -0
index 97c0288..b80df6b 100644
@@ -2,6 +2,7 @@ obj-$(CONFIG_AMBA_SP804) += amba-sp804.o
 obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o
 obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o
 obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
+obj-$(CONFIG_CLOCKSOURCE_DIGIC)   += digic.o
 obj-$(CONFIG_CLOCKSOURCE_DUMMY)   += dummy.o
 obj-$(CONFIG_CLOCKSOURCE_MVEBU)   += mvebu.o
 obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
drivers/clocksource/digic.c new file +93 -0

93 lines not on this page · raw message

Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/11 serial: add driver for Canon DIGIC UART

In reply to Antony Pavlov
---
 drivers/serial/Kconfig        |   4 ++
 drivers/serial/Makefile       |   1 +
 drivers/serial/serial_digic.c | 132 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+)
drivers/serial/Kconfig +4 -0
index 5698c2f..146bf1e 100644
@@ -133,4 +133,8 @@ config DRIVER_SERIAL_CADENCE
 	help
 	  Say Y here if you have a Cadence serial IP core.
 
+config DRIVER_SERIAL_DIGIC
+	bool "Canon DIGIC serial driver"
+	depends on ARCH_DIGIC
+
 endmenu
drivers/serial/Makefile +1 -0
index 2c0176d..189e777 100644
@@ -19,3 +19,4 @@ obj-$(CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT)	+= serial_omap4_usbboot.o
 obj-$(CONFIG_DRIVER_SERIAL_AUART)		+= serial_auart.o
 obj-$(CONFIG_DRIVER_SERIAL_CADENCE)		+= serial_cadence.o
 obj-$(CONFIG_DRIVER_SERIAL_EFI_STDIO)		+= efi-stdio.o
+obj-$(CONFIG_DRIVER_SERIAL_DIGIC)		+= serial_digic.o
drivers/serial/serial_digic.c new file +132 -0

132 lines not on this page · raw message

Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v2 5/11 gpio: add driver for Canon DIGIC

In reply to Antony Pavlov
---
 drivers/gpio/Kconfig      |   4 ++
 drivers/gpio/Makefile     |   1 +
 drivers/gpio/gpio-digic.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 185 insertions(+)
drivers/gpio/Kconfig +4 -0
index 6928fcb..0ca7df4 100644
@@ -9,6 +9,10 @@ menu "GPIO"
 config GPIO_GENERIC
 	bool
 
+config GPIO_DIGIC
+	bool "GPIO support for Canon DIGIC"
+	depends on ARCH_DIGIC
+
 config GPIO_BCM2835
 	bool "GPIO support for BCM2835"
 	depends on ARCH_BCM2835
drivers/gpio/Makefile +1 -0
index ece5efd..510d146 100644
@@ -3,6 +3,7 @@ obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 obj-$(CONFIG_GPIO_BCM2835)	+= gpio-bcm2835.o
 obj-$(CONFIG_GPIO_DAVINCI)	+= gpio-davinci.o
 obj-$(CONFIG_GPIO_CLPS711X)	+= gpio-clps711x.o
+obj-$(CONFIG_GPIO_DIGIC)	+= gpio-digic.o
 obj-$(CONFIG_GPIO_GENERIC)	+= gpio-generic.o
 obj-$(CONFIG_GPIO_IMX)		+= gpio-imx.o
 obj-$(CONFIG_GPIO_JZ4740)	+= gpio-jz4740.o
drivers/gpio/gpio-digic.c new file +180 -0

180 lines not on this page · raw message

Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 6/11 ARM: DIGIC: add Canon PowerShot A1100 IS support

In reply to Antony Pavlov
---
 arch/arm/boards/Makefile               |  1 +
 arch/arm/boards/canon-a1100/Makefile   |  1 +
 arch/arm/boards/canon-a1100/lowlevel.c | 23 ++++++++++++++++++++++
 arch/arm/dts/canon-a1100.dts           | 35 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-digic/Kconfig            |  7 +++++++
 5 files changed, 67 insertions(+)
arch/arm/boards/Makefile +1 -0
index 2ed3730..c60da81 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_MACH_AT91SAM9N12EK)		+= at91sam9n12ek/
 obj-$(CONFIG_MACH_AT91SAM9X5EK)			+= at91sam9x5ek/
 obj-$(CONFIG_MACH_BEAGLE)			+= beagle/
 obj-$(CONFIG_MACH_BEAGLEBONE)			+= beaglebone/
+obj-$(CONFIG_MACH_CANON_A1100)			+= canon-a1100/
 obj-$(CONFIG_MACH_NITROGEN6X)			+= boundarydevices-nitrogen6x/
 obj-$(CONFIG_MACH_CCMX51)			+= ccxmx51/
 obj-$(CONFIG_MACH_CFA10036)			+= crystalfontz-cfa10036/
arch/arm/boards/canon-a1100/Makefile new file +1 -0
new file mode 100644
index 0000000..b08c4a9
@@ -0,0 +1 @@
+lwl-y += lowlevel.o
arch/arm/boards/canon-a1100/lowlevel.c new file +23 -0
new file mode 100644
index 0000000..bbae825
@@ -0,0 +1,23 @@
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+	arm_cpu_lowlevel_init();
+
+	/* FIXME: can we determine RAM size using CP15 register?
+	 *
+	 * see http://chdk.setepontos.com/index.php?topic=5980.90
+	 *
+	 * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0363e/Bgbcdeca.html
+	 * 4.2.19. c6, MPU memory region programming registers
+	 *
+	 * But the 'cpuinfo' command says that the Protection
+	 * unit is disabled.
+	 * The Control Register value (mrc    p15, 0, %0, c0, c1, 4)
+	 * is 0x00051078.
+	 */
+	barebox_arm_entry(0x0, SZ_64M, 0);
+}
arch/arm/dts/canon-a1100.dts new file +35 -0
new file mode 100644
index 0000000..a88eacf
@@ -0,0 +1,35 @@
+/dts-v1/;
+
+/include/ "digic4.dtsi"
+
+/ {
+	model = "Canon PowerShot A1100 IS";
+	compatible = "canon,a1100";
+
+	memory {
+		reg = <0x00000000 0x04000000>;
+	};
+
+	flash@f8000000 {
+		compatible = "cfi-flash";
+		reg = <0xf8000000 0x08000000>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		direct_print {
+			label = "direct-print (blue)";
+			gpios = <&gpio 51 0>;
+		};
+
+		auto_focus {
+			label = "auto-focus (red)";
+			gpios = <&gpio 55 0>;
+		};
+	};
+};
+
+&timer2 {
+        status = "okay";
+};
arch/arm/mach-digic/Kconfig +7 -0
index 49ce44a..d25c3b3 100644
@@ -3,6 +3,13 @@ if ARCH_DIGIC
 choice
 	prompt "camera type"
 
+config MACH_CANON_A1100
+	bool "Canon PowerShot A1100 IS"
+
 endchoice
 
+config ARCH_TEXT_BASE
+	hex
+	default 0x00001900 if MACH_CANON_A1100
+
 endif
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 7/11 ARM: add Canon A1100 ROM image generation

In reply to Antony Pavlov
---
 .gitignore                |  1 +
 Makefile                  |  2 +-
 arch/arm/Makefile         | 10 ++++++++++
 scripts/canon-a1100-image | 10 ++++++++++
 4 files changed, 22 insertions(+), 1 deletion(-)
.gitignore +1 -0
index ddeb7b1..a62e08c 100644
@@ -47,6 +47,7 @@ barebox.map
 barebox.kwb
 barebox.kwbuart
 barebox.efi
+barebox.canon-a1100.bin
 barebox-flash-image
 System.map
 Module.symvers
Makefile +1 -1
index 3d08818..1ec0bfd 100644
@@ -994,7 +994,7 @@ CLEAN_FILES +=	barebox System.map include/generated/barebox_default_env.h \
 		scripts/bareboxenv-target barebox-flash-image \
 		barebox.srec barebox.s5p barebox.ubl barebox.zynq \
 		barebox.uimage barebox.spi barebox.kwb barebox.kwbuart \
-		barebox.efi
+		barebox.efi barebox.canon-a1100.bin
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2 usr/include
arch/arm/Makefile +10 -0
index 1b0d7fe..337aef1 100644
@@ -185,6 +185,16 @@ ifeq ($(machine-y),zynq)
 KBUILD_IMAGE := barebox.zynq
 endif
 
+quiet_cmd_canon_a1100_image = DD      $@
+      cmd_canon_a1100_image = scripts/canon-a1100-image $< $@ || \
+	echo "WARNING: Couldn't create Canon A1100 image due to previous errors."
+barebox.canon-a1100.bin: $(KBUILD_BINARY) FORCE
+	$(call if_changed,canon_a1100_image)
+
+ifeq ($(CONFIG_MACH_CANON_A1100),y)
+KBUILD_IMAGE := barebox.canon-a1100.bin
+endif
+
 KWBIMAGE_OPTS = \
 	-c -i $(srctree)/$(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)
 
scripts/canon-a1100-image new file +10 -0
new file mode 100755
index 0000000..6c08d74
@@ -0,0 +1,10 @@
+#!/bin/bash -e
+
+IFILE=$1
+OFILE=$2
+
+dd if=/dev/zero bs=4M count=1 of=$OFILE 2>/dev/null
+dd if=$IFILE of=$OFILE conv=notrunc 2>/dev/null
+
+# 0xffff0000:  fe 3f f0 ea     b       0xffc00000
+echo -n -e "\xfe\x3f\xf0\xea" | dd of=$OFILE bs=64K seek=63 conv=notrunc 2>/dev/null
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH v2 8/11 ARM: DIGIC: add canon-a1100_defconfig

In reply to Antony Pavlov
---
 arch/arm/configs/canon-a1100_defconfig | 56 ++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
arch/arm/configs/canon-a1100_defconfig new file +56 -0
new file mode 100644
index 0000000..5c1e195
@@ -0,0 +1,56 @@
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_NAME="canon-a1100"
+CONFIG_ARCH_DIGIC=y
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_IMAGE_COMPRESSION_LZ4=y
+CONFIG_TEXT_BASE=0x00300000
+CONFIG_MALLOC_SIZE=0x200000
+CONFIG_PROMPT="canon-a1100 > "
+CONFIG_GLOB=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_DEBUG_LL=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=y
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_GO=y
+CONFIG_CMD_LOADY=y
+# CONFIG_CMD_MOUNT is not set
+# CONFIG_CMD_UMOUNT is not set
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_GLOBAL=y
+CONFIG_CMD_MD5SUM=y
+# CONFIG_CMD_PWD is not set
+CONFIG_CMD_SHA1SUM=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_SLEEP=y
+# CONFIG_CMD_CLEAR is not set
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_MM=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_OFDEVICE=y
+CONFIG_DRIVER_SERIAL_DIGIC=y
+# CONFIG_SPI is not set
+CONFIG_MTD=y
+# CONFIG_MTD_WRITE is not set
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+CONFIG_CLOCKSOURCE_DUMMY=y
+CONFIG_CLOCKSOURCE_DUMMY_RATE=2000
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_GPIO_DIGIC=y
+CONFIG_ZLIB=y
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

PATCH v2 9/11 Documentation: add QEMU Canon A1100 barebox mini-howto

In reply to Antony Pavlov
---
 Documentation/boards/digic.rst | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/boards/digic.rst new file +16 -0
new file mode 100644
index 0000000..e2c49b6
@@ -0,0 +1,16 @@
+Canon DIGIC
+===========
+
+Canon PowerShot A1100 IS
+------------------------
+
+Running barebox on QEMU
+^^^^^^^^^^^^^^^^^^^^^^^
+
+QEMU supports Canon A1100 camera emulation since version 2.0.
+
+Usage::
+
+  $ qemu-system-arm -M canon-a1100 \
+      -nographic -monitor null -serial stdio \
+      -bios barebox.canon-a1100.bin
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

PATCH v2 10/11 ARM: add Canon A1100 DISKBOOT.BIN image generation stuff

In reply to Antony Pavlov

This commit makes it possible to run barebox on real Canon A1100 camera.

The 'dancingbits' utility imported from CHDK software; see http://chdk.wikia.com/ for details.

---
 .gitignore            |  1 +
 Makefile              |  2 +-
 arch/arm/Makefile     |  8 +++++-
 scripts/.gitignore    |  1 +
 scripts/Makefile      |  1 +
 scripts/dancingbits.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/dancingbits.h | 20 +++++++++++++
 scripts/mkdiskboot    | 13 +++++++++
 8 files changed, 121 insertions(+), 2 deletions(-)
.gitignore +1 -0
index a62e08c..39e10b1 100644
@@ -48,6 +48,7 @@ barebox.kwb
 barebox.kwbuart
 barebox.efi
 barebox.canon-a1100.bin
+DISKBOOT-A1100.BIN
 barebox-flash-image
 System.map
 Module.symvers
Makefile +1 -1
index 1ec0bfd..932bd4a 100644
@@ -994,7 +994,7 @@ CLEAN_FILES +=	barebox System.map include/generated/barebox_default_env.h \
 		scripts/bareboxenv-target barebox-flash-image \
 		barebox.srec barebox.s5p barebox.ubl barebox.zynq \
 		barebox.uimage barebox.spi barebox.kwb barebox.kwbuart \
-		barebox.efi barebox.canon-a1100.bin
+		barebox.efi barebox.canon-a1100.bin DISKBOOT-A1100.BIN
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2 usr/include
arch/arm/Makefile +7 -1
index 337aef1..6960397 100644
@@ -191,8 +191,14 @@ quiet_cmd_canon_a1100_image = DD      $@
 barebox.canon-a1100.bin: $(KBUILD_BINARY) FORCE
 	$(call if_changed,canon_a1100_image)
 
+quiet_cmd_canon_a1100_diskboot_image = DB      $@
+      cmd_canon_a1100_diskboot_image = scripts/mkdiskboot $< $@ || \
+	echo "WARNING: Couldn't create Canon A1100 DISKBOOT image due to previous errors."
+DISKBOOT-A1100.BIN: $(KBUILD_BINARY) FORCE
+	$(call if_changed,canon_a1100_diskboot_image)
+
 ifeq ($(CONFIG_MACH_CANON_A1100),y)
-KBUILD_IMAGE := barebox.canon-a1100.bin
+KBUILD_IMAGE := barebox.canon-a1100.bin DISKBOOT-A1100.BIN
 endif
 
 KWBIMAGE_OPTS = \
scripts/.gitignore +1 -0
index fddc04b..09d0611 100644
@@ -1,5 +1,6 @@
 bareboxenv
 bin2c
+dancingbits
 fix_size
 gen_netx_image
 kallsyms
scripts/Makefile +1 -0
index 9c77680..3d92228 100644
@@ -11,6 +11,7 @@ hostprogs-y                      += bareboxenv
 hostprogs-y                      += bareboxcrc32
 hostprogs-y                      += kernel-install
 hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
+hostprogs-$(CONFIG_ARCH_DIGIC)   += dancingbits
 hostprogs-$(CONFIG_ARCH_MVEBU)   += kwbimage kwboot
 hostprogs-$(CONFIG_ARCH_NETX)    += gen_netx_image
 hostprogs-$(CONFIG_ARCH_OMAP)    += omap_signGP mk-am3xxx-spi-image
scripts/dancingbits.c new file +77 -0

77 lines not on this page · raw message

scripts/dancingbits.h new file +20 -0
new file mode 100644
index 0000000..787f85f
@@ -0,0 +1,20 @@
+
+// Dancing bits data for encoding diskboot.bin file
+// Used by dancingbits.c and finsig_dryos.c
+
+#define VITALY 12
+unsigned char _chr_[VITALY][8] = {
+									{ 4,6,1,0,7,2,5,3 }, // original flavor
+									{ 5,3,6,1,2,7,0,4 }, // nacho cheese sx200is, ixus100_sd780, ixu95_sd1200, a1100, d10
+									{ 2,5,0,4,6,1,3,7 }, // mesquite bbq ixus200_sd980, sx20 (dryos r39)
+									{ 4,7,3,2,6,5,0,1 }, // cool ranch a3100 (dryos r43)
+									{ 3,2,7,5,1,4,6,0 }, // cajun chicken s95, g12, sx30 (dryos r45)
+									{ 0,4,2,7,3,6,5,1 }, // spicy wasabi sx220, sx230, ixus310 (dryos r47)
+									{ 7,1,5,3,0,6,4,2 }, // sea salt & vinegar sx40hs, sx150is (dryos r49)
+									{ 6,3,1,0,5,7,2,4 }, // spicy habenaro sx260hs (dryos r50)
+									{ 1,0,4,6,2,3,7,5 }, // tapatio hot sauce sx160is (dryos r51)
+									{ 3,6,7,2,4,5,1,0 }, // blazin' jalapeno a1400 (dryos r52)
+									{ 0,2,6,3,1,4,7,5 }, // guacamole sx510hs (dryos r52)
+									{ 2,7,0,6,3,1,5,4 }, // (dryos r54)
+								};
+
scripts/mkdiskboot new file +13 -0
new file mode 100755
index 0000000..d7d62d2
@@ -0,0 +1,13 @@
+#!/bin/bash -e
+
+IFILE=$1
+OFILE=$2
+
+TFILE=$(mktemp)
+
+dd if=/dev/zero of=$TFILE bs=1k count=128 2>/dev/null
+dd if=$IFILE of=$TFILE conv=notrunc 2>/dev/null
+
+scripts/dancingbits $TFILE $OFILE 2
+
+rm -f $TFILE
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH v2 11/11 Documentation: add real Canon A1100 camera barebox mini-howto

In reply to Antony Pavlov
---
 Documentation/boards/digic.rst | 53 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
Documentation/boards/digic.rst +53 -0
index e2c49b6..50a6ee8 100644
@@ -14,3 +14,56 @@ Usage::
   $ qemu-system-arm -M canon-a1100 \
       -nographic -monitor null -serial stdio \
       -bios barebox.canon-a1100.bin
+
+
+Running barebox on real camera
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Install CHDK firmware on SD-card (see http://chdk.wikia.com/wiki/CHDK_For_Newbies_-_How_To_Install and http://chdk.wikia.com/wiki/A1100).
+
+Make your SD-card bootable (see http://chdk.wikia.com/wiki/Prepare_your_SD_card).
+
+Build barebox: you will get the ``DISKBOOT-A1100.BIN`` file.
+
+Overwrite CHDK boot file on your SD-card (``DISKBOOT.BIN``)
+with the barebox ``DISKBOOT-A1100.BIN`` file.
+
+Lock your SD-card (use small switch on the card).
+**It is obligatory!**
+
+Insert the SD-card into your camera.
+Close your camera's SD-card slot.
+
+
+Turn your camera on (press the 'Playback mode' button).
+Barebox will run; it will use the serial port for console
+(see http://chdk.wikia.com/wiki/UART for details on A1100
+UART connection).
+
+
+LED script
+~~~~~~~~~~
+
+If you have no oppotunity to use camera's serial port then
+you can use leds for checking barebox.
+
+Enable ``CONFIG_DEFAULT_ENVIRONMENT`` in the ``.config``
+and set ``CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/canon-a1100/env"``.
+
+Use this ``arch/arm/boards/canon-600d/env/bin/init``::
+
+  #!/bin/sh
+  
+  # use "direct print" led (blue)
+  LED=0
+  
+  DELAY=300
+  
+  for i in 1 2 3; do
+         led $LED 1
+         msleep $DELAY
+         led $LED 0
+         msleep $DELAY
+  done
+
+After barebox start the camera's blue led will blink.
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#12 lore raw
In reply to Antony Pavlov
Quoted 24 lines · Antony Pavlov

Changes since v1:

* fix reset_cpu();
* add real Canon A1100 camera support.

DIGIC is Canon Inc.'s name for a family of SoC for digital cameras and camcorders.

See http://en.wikipedia.org/wiki/DIGIC for details.

There is no publicly available specification for DIGIC chips. All information about DIGIC chip internals is based on reverse engineering efforts made by CHDK (http://chdk.wikia.com) and Magic Lantern (http://www.magiclantern.fm) projects contributors.

Also this patch series adds initial support for Canon PowerShot A1100 IS compact camera (it is my only camera with connected UART interface). As the DIGIC-based cameras differences mostly are unsignificant (e.g. RAM-size, ROM type and size, GPIO usage) the other compact and DSLR cameras support can be easely added.

Quoted 7 lines

One can easely run barebox for Canon A1100 using QEMU version 2.0 or newer.

This patchseries uses some patches already submitted to maillist:

* clean barebox.zynq
* treewide: drop Doxygen stuff

Applied this series up to 9/11 since I'm quite unsure if it's allowed to include a GPLv3+ tool into a GPLv2 project.
There are some ways out of this situation:

- Ask the author to relicense it under GPLv2+
- rewrite the tool
- Use it as external tool
- Convince me that it's allowed ;)

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox