1.1 --- a/README.txt Sat May 14 22:47:06 2016 +0200
1.2 +++ b/README.txt Sat May 14 23:46:35 2016 +0200
1.3 @@ -13,6 +13,21 @@
1.4 boot mode, and thus any payloads will need to be deployed by other means, such
1.5 as through the use of SD/MMC media.
1.6
1.7 +Building a Payload
1.8 +------------------
1.9 +
1.10 +To build the payload for the Ben NanoNote, just run make:
1.11 +
1.12 +make
1.13 +
1.14 +To build the payload for the MiniPC, define MINIPC in the invocation:
1.15 +
1.16 +make MINIPC=yes
1.17 +
1.18 +Make sure to clean if switching between these targets:
1.19 +
1.20 +make clean
1.21 +
1.22 Deployment over USB
1.23 -------------------
1.24
2.1 --- a/include/minipc.h Sat May 14 22:47:06 2016 +0200
2.2 +++ b/include/minipc.h Sat May 14 23:46:35 2016 +0200
2.3 @@ -30,4 +30,6 @@
2.4 #define GPIO_PWM0 94
2.5 #define GPIO_POWER 97
2.6
2.7 +#define GPIO_IRQ IRQ_GPIO3
2.8 +
2.9 #endif /* __MINIPC_H__ */
3.1 --- a/stage2/board-minipc.c Sat May 14 22:47:06 2016 +0200
3.2 +++ b/stage2/board-minipc.c Sat May 14 23:46:35 2016 +0200
3.3 @@ -4,7 +4,7 @@
3.4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
3.5 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn>
3.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com>
3.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
3.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
3.9 *
3.10 * This program is free software: you can redistribute it and/or modify
3.11 * it under the terms of the GNU General Public License as published by
3.12 @@ -95,6 +95,25 @@
3.13 __ost_clear_uf(TIMER_CHAN);
3.14 }
3.15
3.16 +/* GPIO interrupt activation. */
3.17 +
3.18 +void gpio_init_irq()
3.19 +{
3.20 +/*
3.21 + unsigned int i;
3.22 + for (i = 0; i < 7; i++) {
3.23 + __gpio_as_irq_rise_edge(GPIO_KEYIN_BASE + i);
3.24 + }
3.25 +*/
3.26 + __gpio_as_irq_low_level(GPIO_POWER);
3.27 + __intc_unmask_irq(GPIO_IRQ);
3.28 +}
3.29 +
3.30 +int gpio_have_irq(u8 gpio)
3.31 +{
3.32 + return (REG_GPIO_GPFR(gpio / 32) & (1 << (gpio % 32)));
3.33 +}
3.34 +
3.35 /* Board startup detection. */
3.36
3.37 int is_started()
4.1 --- a/stage2/board-nanonote.c Sat May 14 22:47:06 2016 +0200
4.2 +++ b/stage2/board-nanonote.c Sat May 14 23:46:35 2016 +0200
4.3 @@ -4,7 +4,7 @@
4.4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
4.5 * Copyright (C) 2006 Ingenic Semiconductor, <jlwei@ingenic.cn>
4.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com>
4.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
4.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
4.9 *
4.10 * This program is free software: you can redistribute it and/or modify
4.11 * it under the terms of the GNU General Public License as published by
4.12 @@ -172,26 +172,6 @@
4.13 return (REG_GPIO_PXFLG(gpio / 32) & (1 << (gpio % 32)));
4.14 }
4.15
4.16 -void gpio_clear(u8 gpio)
4.17 -{
4.18 - /* Clear interrupt status. */
4.19 -
4.20 - __gpio_ack_irq(gpio);
4.21 - __intc_ack_irq(GPIO_IRQ);
4.22 -}
4.23 -
4.24 -/* Miscellaneous interrupt administration. */
4.25 -
4.26 -void irq_clear()
4.27 -{
4.28 - u8 i;
4.29 -
4.30 - for (i = 0; i < 32; i++) {
4.31 - if (REG_INTC_IPR & (1 << i))
4.32 - __intc_ack_irq(i);
4.33 - }
4.34 -}
4.35 -
4.36 /* Board startup detection. */
4.37
4.38 int is_started()
5.1 --- a/stage2/board.c Sat May 14 22:47:06 2016 +0200
5.2 +++ b/stage2/board.c Sat May 14 23:46:35 2016 +0200
5.3 @@ -3,7 +3,7 @@
5.4 *
5.5 * Copyright (C) 2005-2006 Ingenic Semiconductor, <jlwei@ingenic.cn>
5.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com>
5.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
5.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
5.9 *
5.10 * This program is free software: you can redistribute it and/or modify
5.11 * it under the terms of the GNU General Public License as published by
5.12 @@ -82,7 +82,7 @@
5.13 timestamp = t;
5.14 }
5.15
5.16 -void udelay (unsigned long usec)
5.17 +void udelay(unsigned long usec)
5.18 {
5.19 unsigned long tmo,tmp;
5.20
5.21 @@ -111,7 +111,7 @@
5.22 while (get_timer_masked () < tmo);
5.23 }
5.24
5.25 -void udelay_masked (unsigned long usec)
5.26 +void udelay_masked(unsigned long usec)
5.27 {
5.28 unsigned long tmo;
5.29 unsigned long endtime;
5.30 @@ -156,3 +156,25 @@
5.31 {
5.32 return TIMER_HZ;
5.33 }
5.34 +
5.35 +/* GPIO interrupt administration. */
5.36 +
5.37 +void gpio_clear(u8 gpio)
5.38 +{
5.39 + /* Clear interrupt status. */
5.40 +
5.41 + __gpio_ack_irq(gpio);
5.42 + __intc_ack_irq(GPIO_IRQ);
5.43 +}
5.44 +
5.45 +/* Miscellaneous interrupt administration. */
5.46 +
5.47 +void irq_clear()
5.48 +{
5.49 + u8 i;
5.50 +
5.51 + for (i = 0; i < 32; i++) {
5.52 + if (REG_INTC_IPR & (1 << i))
5.53 + __intc_ack_irq(i);
5.54 + }
5.55 +}
6.1 --- a/stage2/board.h Sat May 14 22:47:06 2016 +0200
6.2 +++ b/stage2/board.h Sat May 14 23:46:35 2016 +0200
6.3 @@ -6,19 +6,39 @@
6.4 void udelay(unsigned long);
6.5 unsigned long get_memory_size();
6.6
6.7 +/* Common timer definitions. */
6.8 +
6.9 #define TIMER_HZ CONFIG_SYS_HZ
6.10 #define TIMER_CHAN 0
6.11 #define TIMER_FDATA 0xffff /* timer full data value, limited to 16 bits */
6.12
6.13 +/* Select the CPU definitions according to the configuration. */
6.14 +
6.15 #ifdef CONFIG_CPU_JZ4730
6.16 +
6.17 #include "jz4730.h"
6.18 #include "jz4730_compat.h"
6.19 #define READ_TIMER __ost_get_count(TIMER_CHAN) /* macro to read the 32 bit timer */
6.20 #define TIMER_CHAN_IRQ IRQ_OST0
6.21 -#else
6.22 +
6.23 +#else /* assume jz4740 */
6.24 +
6.25 #include "jz4740.h"
6.26 #define READ_TIMER REG_TCU_TCNT(TIMER_CHAN) /* macro to read the 16 bit timer */
6.27 #define TIMER_CHAN_IRQ IRQ_TCU0
6.28 -#endif
6.29 +
6.30 +#endif /* CONFIG_CPU_JZ4730 */
6.31 +
6.32 +/* Select the board definitions according to the configuration. */
6.33 +
6.34 +#ifdef CONFIG_CPU_JZ4730_MINIPC
6.35 +
6.36 +#include "minipc.h"
6.37 +
6.38 +#else /* assume NanoNote */
6.39 +
6.40 +#include "nanonote.h"
6.41 +
6.42 +#endif /* CONFIG_CPU_JZ4730_MINIPC */
6.43
6.44 #endif /* __BOARD_H__ */
7.1 --- a/stage2/init.h Sat May 14 22:47:06 2016 +0200
7.2 +++ b/stage2/init.h Sat May 14 23:46:35 2016 +0200
7.3 @@ -22,6 +22,7 @@
7.4 void gpio_clear(u8);
7.5
7.6 /* General. */
7.7 +
7.8 void irq_clear();
7.9
7.10 /* Test for initialisation. */