Skip to contentSkip to conversation

barebox on Canon cameras: serial console and dts support

RFC In review Antony Pavlov 4 participants 17 messages Aug 26, 2013 – Aug 27, 2013

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

cover barebox on Canon cameras: serial console and dts support

Please don't commit the patches!

This patch series introduce support
for Canon DIGIC4-based cameras.

Changes since the previous (2013-08-04) version:
* serial console support! (tested on Canon PowerShot A1100 only)
* Y-Modem works!
* gpio driver;
* the serial and gpio driver have device tree support.

With serial console support barebox is a handy tool for Canon DIGIC register map exploration.

Supported cameras:

* Canon PowerShot A1100;
* Canon EOS 600D;
* Canon EOS Magic Lantern qemu-based emulator.

Very short Instruction
======================

***************************************************
* *
* THIS IS DANGEROUS AND MIGHT DAMAGE YOUR CAMERA. *
* NO WARRANTIES. NO GUARANTEES. DO NOT TAUNT. *
* *
***************************************************

The recommended ARM toolchain for barebox and Magic Lantern build is 'gcc-arm-embedded'
see https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q2-update

1. Canon EOS 600D DSLR
----------------------

1.1 Install Magic Lantern firmware on a SD-card
(see http://magiclantern.wikia.com/wiki/Unified/Install#First-time_installation)

1.2 Download and build barebox

    $ git clone -b next.digic.20130826 https://github.com/frantony/barebox barebox.digic
    $ cd barebox.digic
    $ export ARCH=arm
    $ export CROSS_COMPILE=<your_ARM_toolchain_prefix>
    $ make canon-600d_defconfig
    $ make

You will get the 'arch/arm/pbl/zbarebox.bin' file.

1.3 Overwrite Magic Lantern boot file on your 600D SD-card with the 'zbarebox.bin' file. E.g., if your SD-card is mounted to the '/mnt/sd' dir, then

    $ sudo cp arch/arm/pbl/zbarebox.bin /mnt/sd/autoexec.bin

1.4 Insert SD-card into your camera.

1.5 Close your camera's SD-card slot.

1.6 Just after SD-card slot closing the barebox will start. If all going well the SD-card led start blink.

1.7 Uninstall barebox
Remove battery from your camera and erase the 'autoexec.bin' file from your SD-card.

2. Canon EOS emulator
---------------------

2.1 Download Magic Lantern sources

$ hg clone https://bitbucket.org/hudson/magic-lantern
$ cd magic-lantern

2.2 Setup your build environment

E.g., for Debian Linux:

$ cat > Makefile.user
RST2LATEX=rst2latex
PYTHON=python

GCC_VERSION=
CROSS_COMPILE=<your_ARM_toolchain_prefix>
<ctrl-d>
$

2.3 Buld Magic Lantern for 600D

$ make 600D

If all going well you can try qemu.

2.4 Bulding qemu

 $ cd contrib/qemu
 $ ./install.sh

...

Use install.sh prompt:
1) Compile QEMU
2) Grab a copy of the Canon firmware
3) Enable CONFIG_QEMU=y in your Makefile.user

2.5 Go to your qemu dir and start emulation with ./run_ml_600D.sh The script will build the 'autoexec.bin' and 'qemu-helper.bin'

2.6 Build barebox image (see paragraph 1.2 Download and build barebox).

2.7 Copy zbarebox.bin to autoexec.bin in your qemu dir.

2.8 run qemu manually in qemu dir:

<path-to-the-eos-qemu>/qemu-system-arm -M ML-600D

3. Canon PowerShot A1100 IS
---------------------------
Installing to the A1100 camera is a bit tricky as you need "encrypt" barebox image.

3.1 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).

3.2 Make your SD-card bootable
(see http://chdk.wikia.com/wiki/Prepare_your_SD_card)

3.3 Download and build barebox

    $ git clone -b next.digic.20130826 https://github.com/frantony/barebox barebox.digic
    $ cd barebox.digic
    $ export ARCH=arm
    $ export CROSS_COMPILE=<your_ARM_toolchain_prefix>
    $ make canon-a1100_defconfig
    $ make

You will get the 'arch/arm/pbl/zbarebox.bin' file.

3.4 Download CHDK sources

    $ git clone https://github.com/c10ud/CHDK.git
    $ cd CHDK

3.5 Build the 'dancingbits' encoder

    $ cd tools
    $ cc -o dancingbits dancingbits.c

3.6 encode your barebox image

Go to your barebox dir

3.6.1 Make zbarebox.bin > 128K; camera don't like small binaries :)

    $ dd if=/dev/zero bs=1k count=128 >> arch/arm/pbl/zbarebox.bin

3.6.2 encode

    $ <path-to-dancingbits> arch/arm/pbl/zbarebox.bin DISKBOOT.BIN 2

3.7 Overwrite CHDK boot file on your SD-card with the 'DISKBOOT.BIN' file.

3.9 Lock your SD-card (use small switch on the card).

3.10 Insert the SD-card into your camera.
Close your camera's SD-card slot.

3.11 Turn your camera on.
If all going well the 'direct print' led start blink.

3.12 Uninstall barebox
Remove battery from your camera and erase the 'DISKBOOT.BIN' file from your SD-card.

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

#1 lore raw

RFC 1/8 ARM: add very initial support for Canon DIGIC chips

TODO: the clocksource driver need improvement!

---
 arch/arm/Kconfig                            |  9 ++++
 arch/arm/Makefile                           |  1 +
 arch/arm/dts/digic4.dtsi                    | 24 +++++++++++
 arch/arm/mach-digic/Kconfig                 | 11 +++++
 arch/arm/mach-digic/Makefile                |  2 +
 arch/arm/mach-digic/core.c                  | 24 +++++++++++
 arch/arm/mach-digic/csrc-timer.c            | 67 +++++++++++++++++++++++++++++
 arch/arm/mach-digic/include/mach/debug_ll.h | 40 +++++++++++++++++
 arch/arm/mach-digic/include/mach/digic4.h   | 29 +++++++++++++
 arch/arm/mach-digic/include/mach/gpio.h     |  1 +
 10 files changed, 208 insertions(+)
 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/csrc-timer.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/gpio.h
arch/arm/Kconfig +9 -0
index 687acca..42cae36 100644
@@ -54,6 +54,14 @@ config ARCH_CLPS711X
 	select GPIOLIB
 	select MFD_SYSCON
 
+config ARCH_DIGIC
+	bool "Canon DIGIC-based cameras"
+	select CPU_32v5
+	select HAS_DEBUG_LL
+	select GPIOLIB
+	help
+	  Support for Canon's digital cameras that use the DIGIC4 chip.
+
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
 	select CPU_ARM920T
@@ -173,6 +181,7 @@ source arch/arm/cpu/Kconfig
 source arch/arm/mach-at91/Kconfig
 source arch/arm/mach-bcm2835/Kconfig
 source arch/arm/mach-clps711x/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 590a0d8..99929eb 100644
@@ -54,6 +54,7 @@ AFLAGS   += -include asm/unified.h -msoft-float $(AFLAGS_THUMB2)
 machine-$(CONFIG_ARCH_AT91)		:= at91
 machine-$(CONFIG_ARCH_BCM2835)		:= bcm2835
 machine-$(CONFIG_ARCH_CLPS711X)		:= clps711x
+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 +24 -0
new file mode 100644
index 0000000..8304bbe
@@ -0,0 +1,24 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "canon,digic4";
+
+	uart: uart {
+		compatible = "canon,digic-serial";
+		reg = <0xc0800000 0x1c>;
+	};
+
+	/*
+	 * I don't know real max GPIO number but this page
+	 *   http://magiclantern.wikia.com/wiki/Register_Map#GPIO_Ports
+	 * says about 93 pins on 5DMkIII.
+	 * Assume that DIGIC4 has at least 96 pins.
+	 * So resource size is 96 * 4 = 0x180.
+	 */
+	gpio: gpio {
+		compatible = "canon,digic-gpio";
+		reg = <0xc0220000 0x180>;
+		#gpio-cells = <2>;
+		gpio-controller;
+	};
+};
arch/arm/mach-digic/Kconfig new file +11 -0
new file mode 100644
index 0000000..878a1a9
@@ -0,0 +1,11 @@
+if ARCH_DIGIC
+
+choice
+	prompt "camera type"
+
+endchoice
+
+config DIGIC_CSRC_TIMER
+	bool
+
+endif
arch/arm/mach-digic/Makefile new file +2 -0
new file mode 100644
index 0000000..1d7cb72
@@ -0,0 +1,2 @@
+obj-y += core.o
+obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
arch/arm/mach-digic/core.c new file +24 -0
new file mode 100644
index 0000000..a442633
@@ -0,0 +1,24 @@
+/*
+ * 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)
+{
+	unreachable();
+}
+EXPORT_SYMBOL(reset_cpu);
arch/arm/mach-digic/csrc-timer.c new file +67 -0

67 lines not on this page · raw message

arch/arm/mach-digic/include/mach/debug_ll.h new file +40 -0
new file mode 100644
index 0000000..5f4579e
@@ -0,0 +1,40 @@
+/*
+ * 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 __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+#include <mach/digic4.h>
+
+#define DEBUG_LL_UART         DIGIC4_UART
+
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2
+
+static inline void PUTC_LL(char ch)
+{
+	while (!(readl(DEBUG_LL_UART_ST) & UART_ST_TX_RDY))
+		; /* noop */
+
+	writel(0x06, DEBUG_LL_UART_ST);
+	writel(ch, DEBUG_LL_UART_TX);
+}
+
+#endif
arch/arm/mach-digic/include/mach/digic4.h new file +29 -0
new file mode 100644
index 0000000..c0e50a4
@@ -0,0 +1,29 @@
+/*
+ * 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
+
+#define DIGIC4_TIMER0	0xc0210000
+#define DIGIC4_TIMER1	0xc0210100
+#define DIGIC4_TIMER2	0xc0210200
+
+#define DIGIC4_GPIO(n)	(0xc0220000 + 4*n)
+
+#endif /* __DIGIC4_H__ */
arch/arm/mach-digic/include/mach/gpio.h new file +1 -0
new file mode 100644
index 0000000..306ab4c
@@ -0,0 +1 @@
+#include <asm-generic/gpio.h>
Signature · 7 lines
1.8.4.rc3


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

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Hi Antony,

Quoted 24 lines · Antony Pavlov

TODO: the clocksource driver need improvement!

---
 arch/arm/Kconfig                            |  9 ++++
 arch/arm/Makefile                           |  1 +
 arch/arm/dts/digic4.dtsi                    | 24 +++++++++++
 arch/arm/mach-digic/Kconfig                 | 11 +++++
 arch/arm/mach-digic/Makefile                |  2 +
 arch/arm/mach-digic/core.c                  | 24 +++++++++++
 arch/arm/mach-digic/csrc-timer.c            | 67 +++++++++++++++++++++++++++++
 arch/arm/mach-digic/include/mach/debug_ll.h | 40 +++++++++++++++++
 arch/arm/mach-digic/include/mach/digic4.h   | 29 +++++++++++++
 arch/arm/mach-digic/include/mach/gpio.h     |  1 +
 10 files changed, 208 insertions(+)
 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/csrc-timer.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/gpio.h

...

Quoted 25 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +19 -0
new file mode 100644
index 0000000..5f4579e
@@ -0,0 +1,40 @@
+/*
+ * 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 __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 10 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +10 -0
+
+#include <io.h>
+#include <mach/digic4.h>
+
+#define DEBUG_LL_UART         DIGIC4_UART
+
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

arch/arm/mach-digic/include/mach/debug_ll.h line 36

Quoted 7 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +7 -0
+
+static inline void PUTC_LL(char ch)
+{
+	while (!(readl(DEBUG_LL_UART_ST) & UART_ST_TX_RDY))
+		; /* noop */
+
+	writel(0x06, DEBUG_LL_UART_ST);

could you use a macro here for 0x06?

arch/arm/mach-digic/include/mach/debug_ll.h line 40

Quoted 4 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +4 -0
+	writel(ch, DEBUG_LL_UART_TX);
+}
+
+#endif

thx,

Jason.

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

#3 lore raw

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Quoted 57 lines · On Mon, 26 Aug 2013 09:20:18 -0400 Jason Cooper <[email protected]> wrote:

Hi Antony,

Quoted 24 lines · Antony Pavlov

TODO: the clocksource driver need improvement!

---
 arch/arm/Kconfig                            |  9 ++++
 arch/arm/Makefile                           |  1 +
 arch/arm/dts/digic4.dtsi                    | 24 +++++++++++
 arch/arm/mach-digic/Kconfig                 | 11 +++++
 arch/arm/mach-digic/Makefile                |  2 +
 arch/arm/mach-digic/core.c                  | 24 +++++++++++
 arch/arm/mach-digic/csrc-timer.c            | 67 +++++++++++++++++++++++++++++
 arch/arm/mach-digic/include/mach/debug_ll.h | 40 +++++++++++++++++
 arch/arm/mach-digic/include/mach/digic4.h   | 29 +++++++++++++
 arch/arm/mach-digic/include/mach/gpio.h     |  1 +
 10 files changed, 208 insertions(+)
 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/csrc-timer.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/gpio.h

...

Quoted 29 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +23 -0
new file mode 100644
index 0000000..5f4579e
@@ -0,0 +1,40 @@
+/*
+ * 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 __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+#include <mach/digic4.h>
+
Quoted 8 lines

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 6 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +6 -0
+#define DEBUG_LL_UART         DIGIC4_UART
+
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

The leading whitespace is put here intentionally to distinguish register address macros and bit fields macros.

Quoted 9 lines

arch/arm/mach-digic/include/mach/debug_ll.h line 36

Quoted 7 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +7 -0
+
+static inline void PUTC_LL(char ch)
+{
+	while (!(readl(DEBUG_LL_UART_ST) & UART_ST_TX_RDY))
+		; /* noop */
+
+	writel(0x06, DEBUG_LL_UART_ST);

could you use a macro here for 0x06?

It is not so easy. See comments in serial driver: there is no public documentation on Canon Digic chips. This driver is result of reverse engineering.
I have no complete information about the bitfield meaning. In this situation it's very difficult to invent adequate names for the bitfield macros. E.g. I have given the DEBUG_LL_UART_ST name to the register (I mean STATUS register). But now I see that It is not just a status register but a control register too. Just now I prefere to keep the names and constants as-is.

Moreover the situation with digic timers is worse as I don't know meaning of most bitfields :)

Quoted 8 lines

arch/arm/mach-digic/include/mach/debug_ll.h line 40

Quoted 4 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +4 -0
+	writel(ch, DEBUG_LL_UART_TX);
+}
+
+#endif

thx,

Jason.

Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

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

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Quoted 69 lines · Antony Pavlov
Quoted 57 lines · On Mon, 26 Aug 2013 09:20:18 -0400 Jason Cooper <[email protected]> wrote:

Hi Antony,

Quoted 24 lines · Antony Pavlov

TODO: the clocksource driver need improvement!

---
 arch/arm/Kconfig                            |  9 ++++
 arch/arm/Makefile                           |  1 +
 arch/arm/dts/digic4.dtsi                    | 24 +++++++++++
 arch/arm/mach-digic/Kconfig                 | 11 +++++
 arch/arm/mach-digic/Makefile                |  2 +
 arch/arm/mach-digic/core.c                  | 24 +++++++++++
 arch/arm/mach-digic/csrc-timer.c            | 67 +++++++++++++++++++++++++++++
 arch/arm/mach-digic/include/mach/debug_ll.h | 40 +++++++++++++++++
 arch/arm/mach-digic/include/mach/digic4.h   | 29 +++++++++++++
 arch/arm/mach-digic/include/mach/gpio.h     |  1 +
 10 files changed, 208 insertions(+)
 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/csrc-timer.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/gpio.h

...

Quoted 29 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +23 -0
new file mode 100644
index 0000000..5f4579e
@@ -0,0 +1,40 @@
+/*
+ * 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 __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+#include <mach/digic4.h>
+
Quoted 8 lines

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 6 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +6 -0
+#define DEBUG_LL_UART         DIGIC4_UART
+
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

Quoted 2 lines

The leading whitespace is put here intentionally to distinguish register address macros and bit fields macros.

CodingStyle doesn't spell it out explicitly, however:

$ git grep -c '^[ \t]#define'
arch/arm/mach-omap/include/mach/omap3-silicon.h:2
arch/mips/mach-xburst/include/mach/jz4750d_regs.h:27
include/scsi.h:1

Shows that it isn't widely used. In fact, the above examples probably snuck in and should be cleaned up. git blame shows:

637b3aa7 USB mass storage device driver initial implementation 8b85ac8c MIPS: XBurst: add JZ4755 CPU support 7e4e7b0d omap3: Add macros to extract hawkeye and version

Quoted 11 lines
Quoted 10 lines

arch/arm/mach-digic/include/mach/debug_ll.h line 36

Quoted 8 lines
arch/arm/mach-digic/include/mach/debug_ll.h new file +7 -0
+
+static inline void PUTC_LL(char ch)
+{
+	while (!(readl(DEBUG_LL_UART_ST) & UART_ST_TX_RDY))
+		; /* noop */
+
+	writel(0x06, DEBUG_LL_UART_ST);

could you use a macro here for 0x06?

Quoted 2 lines

It is not so easy. See comments in serial driver: there is no public documentation on Canon Digic chips.

bummer. It's a shame we can't match it up against another IP. I doubt the entire SoC was developed in a vacuum.

Quoted 6 lines

This driver is result of reverse engineering.
I have no complete information about the bitfield meaning. In this situation it's very difficult to invent adequate names for the bitfield macros. E.g. I have given the DEBUG_LL_UART_ST name to the register (I mean STATUS register). But now I see that It is not just a status register but a control register too. Just now I prefere to keep the names and constants as-is.

I agree, we don't want to guess. Perhaps a comment to that effect?

thx,

Jason.

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

#5 lore raw

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Quoted 11 lines · Jason Cooper
Quoted 10 lines · Antony Pavlov
Quoted 7 lines · On Mon, 26 Aug 2013 09:20:18 -0400 Jason Cooper <[email protected]> wrote:

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 4 lines · Antony Pavlov
arch/arm/mach-digic/include/mach/debug_ll.h new file +4 -0
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

Quoted 6 lines
Quoted 2 lines

The leading whitespace is put here intentionally to distinguish register address macros and bit fields macros.

CodingStyle doesn't spell it out explicitly, however:

$ git grep -c '^[ \t]#define'

Jason,

you should have used

git grep -c '^#[ \t]define'

It is in fact quite common to distinguish address offset macros and bit macros by adding a space, but between '#' and 'define'.

Sebastian

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

#6 lore raw

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Quoted 19 lines · Sebastian Hesselbarth
Quoted 11 lines · Jason Cooper
Quoted 10 lines · Antony Pavlov
Quoted 7 lines · On Mon, 26 Aug 2013 09:20:18 -0400 Jason Cooper <[email protected]> wrote:

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 4 lines · Antony Pavlov
arch/arm/mach-digic/include/mach/debug_ll.h new file +4 -0
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

Quoted 6 lines
Quoted 2 lines

The leading whitespace is put here intentionally to distinguish register address macros and bit fields macros.

CodingStyle doesn't spell it out explicitly, however:

$ git grep -c '^[ \t]#define'
Quoted 8 lines

Jason,

you should have used

git grep -c '^#[ \t]define'

It is in fact quite common to distinguish address offset macros and bit macros by adding a space, but between '#' and 'define'.

fair enough, I'll admit it's a personal bias. :-P I like everything lined up vertically so that differences from line to line stand out more. But that's just me, and it's not my code, so I'll drop it.

thx,

Jason.

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

#7 lore raw

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

Quoted 20 lines · On Mon, 26 Aug 2013 21:46:48 -0400 Jason Cooper <[email protected]> wrote:
Quoted 19 lines · Sebastian Hesselbarth
Quoted 17 lines · Jason Cooper
Quoted 10 lines · Antony Pavlov
Quoted 7 lines · On Mon, 26 Aug 2013 09:20:18 -0400 Jason Cooper <[email protected]> wrote:

arch/arm/mach-digic/include/mach/debug_ll.h line 29

Quoted 4 lines · Antony Pavlov
arch/arm/mach-digic/include/mach/debug_ll.h new file +4 -0
+/* Serial interface registers */
+#define DEBUG_LL_UART_TX         (DEBUG_LL_UART + 0x0)
+#define DEBUG_LL_UART_ST         (DEBUG_LL_UART + 0x14)
+ #define UART_ST_TX_RDY	2

leading whitespace, and perhaps use BIT() here.

Quoted 2 lines

The leading whitespace is put here intentionally to distinguish register address macros and bit fields macros.

CodingStyle doesn't spell it out explicitly, however:

$ git grep -c '^[ \t]#define'
Quoted 8 lines
Quoted 8 lines

Jason,

you should have used

git grep -c '^#[ \t]define'

It is in fact quite common to distinguish address offset macros and bit macros by adding a space, but between '#' and 'define'.

Thanks, Sebastian! You are right. I have just misplaced the space :)

Quoted 3 lines

fair enough, I'll admit it's a personal bias. :-P I like everything lined up vertically so that differences from line to line stand out more. But that's just me, and it's not my code, so I'll drop it.

Anyway I have a plan to rework these DEBUG_LL-related macros as they dublicate the macros in the digic-serial driver :)

--
Best regards,
  Antony Pavlov

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

#8 lore raw

Re: [RFC 1/8] ARM: add very initial support for Canon DIGIC chips

In reply to Sebastian Hesselbarth
Quoted 7 lines · On Tuesday 27 August 2013 01:32:49 Sebastian Hesselbarth wrote:

[...]
you should have used

git grep -c '^#[ \t]define'

It is in fact quite common to distinguish address offset macros and bit macros by adding a space, but between '#' and 'define'.

From the GCC webpage:
"Preprocessing directives are recognized in traditional C only when their leading # appears in the first column. There can be no whitespace between the beginning of the line and the #."

jbe

Signature · 7 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

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

RFC 2/8 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 | 131 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 136 insertions(+)
 create mode 100644 drivers/serial/serial_digic.c
drivers/serial/Kconfig +4 -0
index 11fc155..541350d 100644
@@ -122,4 +122,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 93790b5..485a3ef 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_DRIVER_SERIAL_PXA)			+= serial_pxa.o
 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_DIGIC)		+= serial_digic.o
drivers/serial/serial_digic.c new file +131 -0

131 lines not on this page · raw message

Signature · 7 lines
1.8.4.rc3


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

Re: [RFC 2/8] serial: add driver for Canon DIGIC UART

Quoted 54 lines · Antony Pavlov
---
 drivers/serial/Kconfig        |   4 ++
 drivers/serial/Makefile       |   1 +
 drivers/serial/serial_digic.c | 131 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 136 insertions(+)
 create mode 100644 drivers/serial/serial_digic.c
drivers/serial/Kconfig +4 -0
index 11fc155..541350d 100644
@@ -122,4 +122,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 93790b5..485a3ef 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_DRIVER_SERIAL_PXA)			+= serial_pxa.o
 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_DIGIC)		+= serial_digic.o
drivers/serial/serial_digic.c new file +18 -0
new file mode 100644
index 0000000..938172f
@@ -0,0 +1,131 @@
+/*
+ * 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>

drivers/serial/serial_digic.c line 28

Quoted 10 lines
drivers/serial/serial_digic.c new file +10 -0
+#include <init.h>
+#include <malloc.h>
+#include <io.h>
+
+/* Serial interface registers offsets */
+#define UART_TX	0x0
+#define UART_RX	0x4
+#define UART_ST	0x14
+ #define UART_ST_RX_RDY	1
+ #define UART_ST_TX_RDY	2

leading whitespace, BIT().

Quoted 23 lines
drivers/serial/serial_digic.c new file +23 -0
+
+/*
+ * This driver is based on the "Serial terminal" docs here:
+ *  http://magiclantern.wikia.com/wiki/Register_Map#Misc_Registers
+ *
+ * See also disassembler output for Canon A1100IS firmware
+ * (version a1100_100c):
+ *   * a outc-like function can be found at address 0xffff18f0;
+ *   * a getc-like function can be found at address 0xffff192c.
+ */
+
+static inline uint32_t digic_serial_readl(struct console_device *cdev, uint32_t off)
+{
+	void *digic = cdev->dev->priv;
+
+	return readl(digic + off);
+}
+
+static inline void digic_serial_writel(struct console_device *cdev, uint32_t val,
+			  uint32_t off)
+{
+	void *digic = cdev->dev->priv;
+

drivers/serial/serial_digic.c line 60

Quoted 10 lines
drivers/serial/serial_digic.c new file +9 -0
+	writel(val, digic + off);
+}
+
 
+static int digic_serial_setbaudrate(struct console_device *cdev, int baudrate)
+{
+	/* FIXME: empty */
+
+	return 0;
+}

You don't need this, see below.

Quoted 41 lines
drivers/serial/serial_digic.c new file +41 -0
+
+static void digic_serial_putc(struct console_device *cdev, char c)
+{
+	while (!(digic_serial_readl(cdev, UART_ST) & UART_ST_TX_RDY))
+		; /* noop */
+
+	digic_serial_writel(cdev, 0x06, UART_ST);
+	digic_serial_writel(cdev, c, UART_TX);
+}
+
+static int digic_serial_getc(struct console_device *cdev)
+{
+	while (!(digic_serial_readl(cdev, UART_ST) & UART_ST_RX_RDY))
+		; /* noop */
+
+	digic_serial_writel(cdev, 0x01, UART_ST);
+
+	return digic_serial_readl(cdev, UART_RX);
+}
+
+static int digic_serial_tstc(struct console_device *cdev)
+{
+	return ((digic_serial_readl(cdev, UART_ST) & UART_ST_RX_RDY) != 0);
+
+	/*
+	 * Canon folks use additional check, something like this:
+	 *
+	 *		if (digic_serial_readl(cdev, UART_ST) & 0x38) {
+	 *			digic_serial_writel(cdev, 0x38, UART_ST);
+	 *			return 0;
+	 *		}
+	 *
+	 * But I know nothing about these magic bits in the status regster...
+	 *
+	*/
+}
+
+static int digic_serial_probe(struct device_d *dev)
+{
+	struct console_device *cdev;
+

drivers/serial/serial_digic.c line 109

Quoted 10 lines
drivers/serial/serial_digic.c new file +8 -0
+	cdev = xzalloc(sizeof(struct console_device));
+	dev->priv = dev_request_mem_region(dev, 0);
+	cdev->dev = dev;
+	cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
+	cdev->tstc = &digic_serial_tstc;
+	cdev->putc = &digic_serial_putc;
+	cdev->getc = &digic_serial_getc;
 
 
+	cdev->setbrg = &digic_serial_setbaudrate;

It's probably better to set this to NULL, since you don't know how change the baud rate (and remove digic_serial_setbaudrate(), above).

thx,

Jason.

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

#11 lore raw

RFC 3/8 gpio: add driver for Canon DIGIC

In reply to Antony Pavlov
---
 drivers/gpio/Kconfig      |   4 ++
 drivers/gpio/Makefile     |   1 +
 drivers/gpio/gpio-digic.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 181 insertions(+)
 create mode 100644 drivers/gpio/gpio-digic.c
drivers/gpio/Kconfig +4 -0
index d5ac532..f112db8 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 adb668f..c5cf58a 100644
@@ -2,6 +2,7 @@ obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 
 obj-$(CONFIG_GPIO_BCM2835)	+= gpio-bcm2835.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_ORION)	+= gpio-orion.o
drivers/gpio/gpio-digic.c new file +176 -0

176 lines not on this page · raw message

Signature · 7 lines
1.8.4.rc3


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

RFC 4/8 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/env/bin/init | 15 +++++++++++++++
 arch/arm/boards/canon-a1100/env/bin/zup  | 11 +++++++++++
 arch/arm/boards/canon-a1100/lowlevel.c   | 23 +++++++++++++++++++++++
 arch/arm/dts/canon-a1100.dts             | 26 ++++++++++++++++++++++++++
 arch/arm/mach-digic/Kconfig              |  8 ++++++++
 7 files changed, 85 insertions(+)
 create mode 100644 arch/arm/boards/canon-a1100/Makefile
 create mode 100644 arch/arm/boards/canon-a1100/env/bin/init
 create mode 100644 arch/arm/boards/canon-a1100/env/bin/zup
 create mode 100644 arch/arm/boards/canon-a1100/lowlevel.c
 create mode 100644 arch/arm/dts/canon-a1100.dts
arch/arm/boards/Makefile +1 -0
index 38ef512..76f21be 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_CCMX51)			+= ccxmx51/
 obj-$(CONFIG_MACH_CFA10036)			+= crystalfontz-cfa10036/
 obj-$(CONFIG_MACH_CHUMBY)			+= chumby_falconwing/
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/env/bin/init new file +15 -0
new file mode 100644
index 0000000..509643d
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+export PATH=/env/bin
+
+# 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
arch/arm/boards/canon-a1100/env/bin/zup new file +11 -0
new file mode 100644
index 0000000..84bfd2f
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# on Canon PowerShot A1100 IS we can use 0x400000
+LOADADDR=0x400000
+IMGNAME=zbarebox.bin
+
+loady
+if [ -e $IMGNAME ]; then
+	memcpy -s $IMGNAME 0 $LOADADDR
+	go $LOADADDR
+fi
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 +26 -0
new file mode 100644
index 0000000..dfa1d72
@@ -0,0 +1,26 @@
+/dts-v1/;
+
+/include/ "digic4.dtsi"
+
+/ {
+	model = "Canon PowerShot A1100 IS";
+	compatible = "canon,a1100";
+
+	memory {
+		reg = <0x00000000 0x04000000>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		direct_print {
+			label = "direct-print led (blue)";
+			gpios = <&gpio 51 0>;
+		};
+
+		auto_focus {
+			label = "auto-focus led (red)";
+			gpios = <&gpio 55 0>;
+		};
+	};
+};
arch/arm/mach-digic/Kconfig +8 -0
index 878a1a9..557cad4 100644
@@ -3,8 +3,16 @@ if ARCH_DIGIC
 choice
 	prompt "camera type"
 
+config MACH_CANON_A1100
+	bool "Canon PowerShot A1100 IS"
+	select DIGIC_CSRC_TIMER
+
 endchoice
 
+config ARCH_TEXT_BASE
+	hex
+	default 0x00001900 if MACH_CANON_A1100
+
 config DIGIC_CSRC_TIMER
 	bool
 
Signature · 7 lines
1.8.4.rc3


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

RFC 5/8 ARM: DIGIC: add canon-a1100_defconfig

In reply to Antony Pavlov
---
 arch/arm/configs/canon-a1100_defconfig | 53 ++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 arch/arm/configs/canon-a1100_defconfig
arch/arm/configs/canon-a1100_defconfig new file +53 -0
new file mode 100644
index 0000000..60deabd
@@ -0,0 +1,53 @@
+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_PBL_RELOCATABLE=y
+CONFIG_IMAGE_COMPRESSION_LZ4=y
+CONFIG_TEXT_BASE=0x00300000
+CONFIG_MALLOC_SIZE=0x200000
+CONFIG_PROMPT="canon> "
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_HUSH_GETOPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/canon-a1100/env"
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_GLOBAL=y
+# CONFIG_CMD_RM is not set
+# CONFIG_CMD_MKDIR is not set
+# CONFIG_CMD_RMDIR is not set
+# CONFIG_CMD_PWD is not set
+# CONFIG_CMD_MOUNT is not set
+# CONFIG_CMD_UMOUNT is not set
+# CONFIG_CMD_CLEAR is not set
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MM=y
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_DRIVER_SERIAL_DIGIC=y
+# CONFIG_SPI is not set
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_GPIO_DIGIC=y
+CONFIG_ZLIB=y
Signature · 7 lines
1.8.4.rc3


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

RFC 6/8 ARM: DIGIC: add csrc-dummy

In reply to Antony Pavlov

The clocksource csrc-timer driver that uses DIGIC
hardware TIMER2 perfectrly works on Canon A1100,
but does not works on Canon EOS 600D.
IMHO we need additional timer initialisation.

This patch introduces a quick-and-dirty termporary solution for this situation: a clocksource driver that does not use any hardware at all.

Also this driver is very handy for running barebox on Magic Lantern EOS qemu-based emulator as
the emulator does not realize timer counter register at all!

---
 arch/arm/mach-digic/Kconfig      |  4 ++++
 arch/arm/mach-digic/Makefile     |  1 +
 arch/arm/mach-digic/csrc-dummy.c | 49 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+)
 create mode 100644 arch/arm/mach-digic/csrc-dummy.c
arch/arm/mach-digic/Kconfig +4 -0
index 557cad4..b3de2d9 100644
@@ -13,7 +13,11 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x00001900 if MACH_CANON_A1100
 
+
 config DIGIC_CSRC_TIMER
 	bool
 
+config DIGIC_CSRC_DUMMY
+	bool
+
 endif
arch/arm/mach-digic/Makefile +1 -0
index 1d7cb72..31e5ac1 100644
@@ -1,2 +1,3 @@
 obj-y += core.o
 obj-$(CONFIG_DIGIC_CSRC_TIMER) += csrc-timer.o
+obj-$(CONFIG_DIGIC_CSRC_DUMMY) += csrc-dummy.o
arch/arm/mach-digic/csrc-dummy.c new file +49 -0

49 lines not on this page · raw message

Signature · 7 lines
1.8.4.rc3


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

RFC 7/8 ARM: DIGIC: add Canon EOS 600D support

In reply to Antony Pavlov
---
 arch/arm/boards/Makefile                |  1 +
 arch/arm/boards/canon-600d/Makefile     |  1 +
 arch/arm/boards/canon-600d/env/bin/init | 17 +++++++++++++++++
 arch/arm/boards/canon-600d/env/bin/zup  | 11 +++++++++++
 arch/arm/boards/canon-600d/lowlevel.c   | 23 +++++++++++++++++++++++
 arch/arm/dts/canon-600d.dts             | 21 +++++++++++++++++++++
 arch/arm/mach-digic/Kconfig             |  5 +++++
 7 files changed, 79 insertions(+)
 create mode 100644 arch/arm/boards/canon-600d/Makefile
 create mode 100644 arch/arm/boards/canon-600d/env/bin/init
 create mode 100644 arch/arm/boards/canon-600d/env/bin/zup
 create mode 100644 arch/arm/boards/canon-600d/lowlevel.c
 create mode 100644 arch/arm/dts/canon-600d.dts
arch/arm/boards/Makefile +1 -0
index 76f21be..bb95428 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_600D)			+= canon-600d/
 obj-$(CONFIG_MACH_CANON_A1100)			+= canon-a1100/
 obj-$(CONFIG_MACH_CCMX51)			+= ccxmx51/
 obj-$(CONFIG_MACH_CFA10036)			+= crystalfontz-cfa10036/
arch/arm/boards/canon-600d/Makefile new file +1 -0
new file mode 100644
index 0000000..b08c4a9
@@ -0,0 +1 @@
+lwl-y += lowlevel.o
arch/arm/boards/canon-600d/env/bin/init new file +17 -0
new file mode 100644
index 0000000..478fd23
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+export PATH=/env/bin
+
+# use "direct print" led (blue)
+LED=0
+
+DELAY=300
+
+md 0xF7FFFFF0+0x20
+
+for i in 1 2 3; do
+	led $LED 1
+	msleep $DELAY
+	led $LED 0
+	msleep $DELAY
+done
arch/arm/boards/canon-600d/env/bin/zup new file +11 -0
new file mode 100644
index 0000000..84bfd2f
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# on Canon PowerShot A1100 IS we can use 0x400000
+LOADADDR=0x400000
+IMGNAME=zbarebox.bin
+
+loady
+if [ -e $IMGNAME ]; then
+	memcpy -s $IMGNAME 0 $LOADADDR
+	go $LOADADDR
+fi
arch/arm/boards/canon-600d/lowlevel.c new file +23 -0
new file mode 100644
index 0000000..a588880
@@ -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_256M, 0);
+}
arch/arm/dts/canon-600d.dts new file +21 -0
new file mode 100644
index 0000000..ee1fa4e
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+/include/ "digic4.dtsi"
+
+/ {
+	model = "Canon EOS 600D";
+	compatible = "canon,eos600d";
+
+	memory {
+		reg = <0x00000000 0x10000000>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		sd_slot {
+			label = "sd-card activity led (red)";
+			gpios = <&gpio 77 0>;
+		};
+	};
+};
arch/arm/mach-digic/Kconfig +5 -0
index b3de2d9..31c4a90 100644
@@ -7,11 +7,16 @@ config MACH_CANON_A1100
 	bool "Canon PowerShot A1100 IS"
 	select DIGIC_CSRC_TIMER
 
+config MACH_CANON_600D
+	bool "Canon EOS 600D"
+	select DIGIC_CSRC_DUMMY
+
 endchoice
 
 config ARCH_TEXT_BASE
 	hex
 	default 0x00001900 if MACH_CANON_A1100
+	default 0x00800000 if MACH_CANON_600D
 
 
 config DIGIC_CSRC_TIMER
Signature · 7 lines
1.8.4.rc3


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

RFC 8/8 ARM: DIGIC: add canon-600d_defconfig

In reply to Antony Pavlov
---
 arch/arm/configs/canon-600d_defconfig | 54 +++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 arch/arm/configs/canon-600d_defconfig
arch/arm/configs/canon-600d_defconfig new file +54 -0
new file mode 100644
index 0000000..a8ff597
@@ -0,0 +1,54 @@
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_NAME="canon-600d"
+CONFIG_ARCH_DIGIC=y
+CONFIG_MACH_CANON_600D=y
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_PBL_RELOCATABLE=y
+CONFIG_IMAGE_COMPRESSION_LZ4=y
+CONFIG_TEXT_BASE=0x00300000
+CONFIG_MALLOC_SIZE=0x200000
+CONFIG_PROMPT="canon> "
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_HUSH_GETOPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/canon-600d/env"
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_GLOBAL=y
+# CONFIG_CMD_RM is not set
+# CONFIG_CMD_MKDIR is not set
+# CONFIG_CMD_RMDIR is not set
+# CONFIG_CMD_PWD is not set
+# CONFIG_CMD_MOUNT is not set
+# CONFIG_CMD_UMOUNT is not set
+# CONFIG_CMD_CLEAR is not set
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MM=y
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTU is not set
+CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_DRIVER_SERIAL_DIGIC=y
+# CONFIG_SPI is not set
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_GPIO_DIGIC=y
+CONFIG_ZLIB=y
Signature · 7 lines
1.8.4.rc3


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