1.1 --- a/include/nanonote.h Tue Jan 26 16:57:26 2016 +0100
1.2 +++ b/include/nanonote.h Tue Jan 26 21:34:25 2016 +0100
1.3 @@ -42,6 +42,8 @@
1.4 #define GPIO_KEYIN_BASE (3 * 32 + 18)
1.5 #define GPIO_KEYIN_8 (3 * 32 + 26)
1.6
1.7 +#define GPIO_POWER (3 * 32 + 29)
1.8 +
1.9 #define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */
1.10 #define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */
1.11
1.12 @@ -51,4 +53,6 @@
1.13 #define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */
1.14 #define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */
1.15
1.16 +#define GPIO_IRQ IRQ_GPIO3
1.17 +
1.18 #endif /* __NANONOTE_H__ */
2.1 --- a/stage2/board-nanonote.c Tue Jan 26 16:57:26 2016 +0100
2.2 +++ b/stage2/board-nanonote.c Tue Jan 26 21:34:25 2016 +0100
2.3 @@ -4,7 +4,7 @@
2.4 * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
2.5 * Copyright (C) 2006 Ingenic Semiconductor, <jlwei@ingenic.cn>
2.6 * Copyright (C) Xiangfu Liu <xiangfu.z@gmail.com>
2.7 - * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
2.8 + * Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
2.9 *
2.10 * This program is free software: you can redistribute it and/or modify
2.11 * it under the terms of the GNU General Public License as published by
2.12 @@ -41,10 +41,6 @@
2.13 * Initialize Other pins
2.14 */
2.15 unsigned int i;
2.16 - for (i = 0; i < 7; i++){
2.17 - __gpio_as_input(GPIO_KEYIN_BASE + i);
2.18 - __gpio_enable_pull(GPIO_KEYIN_BASE + i);
2.19 - }
2.20
2.21 for (i = 0; i < 8; i++) {
2.22 __gpio_as_output(GPIO_KEYOUT_BASE + i);
2.23 @@ -144,6 +140,20 @@
2.24 __intc_unmask_irq(TIMER_CHAN_IRQ);
2.25 }
2.26
2.27 +/* GPIO interrupt activation. */
2.28 +
2.29 +void gpio_init_irq(void)
2.30 +{
2.31 +/*
2.32 + unsigned int i;
2.33 + for (i = 0; i < 7; i++) {
2.34 + __gpio_as_irq_rise_edge(GPIO_KEYIN_BASE + i);
2.35 + }
2.36 +*/
2.37 + __gpio_as_irq_rise_edge(GPIO_POWER);
2.38 + __intc_unmask_irq(GPIO_IRQ);
2.39 +}
2.40 +
2.41 /* Board startup detection. */
2.42
2.43 int is_started(void)
3.1 --- a/stage2/board-specific.h Tue Jan 26 16:57:26 2016 +0100
3.2 +++ b/stage2/board-specific.h Tue Jan 26 21:34:25 2016 +0100
3.3 @@ -8,6 +8,7 @@
3.4 void rtc_init(void);
3.5 void timer_init(void);
3.6 void timer_init_irq(void);
3.7 +void gpio_init_irq(void);
3.8 int is_started(void);
3.9
3.10 #endif /* __BOARD_SPECIFIC_H__ */
4.1 --- a/stage2/irq.c Tue Jan 26 16:57:26 2016 +0100
4.2 +++ b/stage2/irq.c Tue Jan 26 21:34:25 2016 +0100
4.3 @@ -1,7 +1,7 @@
4.4 /*
4.5 * Interrupt handling.
4.6 *
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 @@ -17,6 +17,12 @@
4.13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
4.14 */
4.15
4.16 +#ifdef CONFIG_CPU_JZ4730_MINIPC
4.17 +#include "minipc.h"
4.18 +#else
4.19 +#include "nanonote.h"
4.20 +#endif
4.21 +
4.22 #include "board-specific.h"
4.23 #include "board.h"
4.24 #include "lcd.h"
4.25 @@ -58,6 +64,7 @@
4.26 void irq_init()
4.27 {
4.28 timer_init_irq();
4.29 + /* gpio_init_irq(); */
4.30 x = 0; y = 0; pixel_type = 1;
4.31 handle_error_level();
4.32 init_interrupts();
4.33 @@ -67,9 +74,12 @@
4.34 void irq_handle()
4.35 {
4.36 unsigned short i;
4.37 + u32 irqnum;
4.38
4.39 /* Check interrupt identity. */
4.40
4.41 + /* Timer interrupt. */
4.42 +
4.43 if (REG_INTC_IPR & (1 << TIMER_CHAN_IRQ)) {
4.44
4.45 /* Update the pixel type. */
4.46 @@ -78,16 +88,29 @@
4.47
4.48 /* Clear interrupt status. */
4.49
4.50 + __tcu_clear_full_match_flag(TIMER_CHAN);
4.51 __intc_ack_irq(TIMER_CHAN_IRQ);
4.52 - __tcu_clear_full_match_flag(TIMER_CHAN);
4.53 + }
4.54 +
4.55 + /* GPIO interrupts. */
4.56 +
4.57 + if (REG_INTC_IPR & (1 << GPIO_IRQ)) {
4.58 + while ((irqnum = __gpio_group_irq(3))) {
4.59 + __gpio_mask_irq(3 * 32 + irqnum);
4.60 +
4.61 + /* Clear interrupt status. */
4.62 +
4.63 + __gpio_ack_irq(3 * 32 + irqnum);
4.64 + __gpio_unmask_irq(3 * 32 + irqnum);
4.65 + }
4.66 + __intc_ack_irq(GPIO_IRQ);
4.67 + }
4.68
4.69 /* Handle other interrupts, anyway. */
4.70
4.71 - } else {
4.72 - for (i = 0; i < 32; i++) {
4.73 - if (REG_INTC_IPR & (1 << i))
4.74 - __intc_ack_irq(i);
4.75 - }
4.76 + for (i = 0; i < 32; i++) {
4.77 + if (REG_INTC_IPR & (1 << i))
4.78 + __intc_ack_irq(i);
4.79 }
4.80 }
4.81