# HG changeset patch # User Paul Boddie # Date 1463262395 -7200 # Node ID 2f6e7237dbb5d22d1ace8ec46db344b6ca1135b5 # Parent 5dc17c3c1773dcf73bf428e63dd84e8267e07102 Added missing support for the MiniPC (untested at present), and moved common functions into the common board support file. diff -r 5dc17c3c1773 -r 2f6e7237dbb5 README.txt --- a/README.txt Sat May 14 22:47:06 2016 +0200 +++ b/README.txt Sat May 14 23:46:35 2016 +0200 @@ -13,6 +13,21 @@ boot mode, and thus any payloads will need to be deployed by other means, such as through the use of SD/MMC media. +Building a Payload +------------------ + +To build the payload for the Ben NanoNote, just run make: + +make + +To build the payload for the MiniPC, define MINIPC in the invocation: + +make MINIPC=yes + +Make sure to clean if switching between these targets: + +make clean + Deployment over USB ------------------- diff -r 5dc17c3c1773 -r 2f6e7237dbb5 include/minipc.h --- a/include/minipc.h Sat May 14 22:47:06 2016 +0200 +++ b/include/minipc.h Sat May 14 23:46:35 2016 +0200 @@ -30,4 +30,6 @@ #define GPIO_PWM0 94 #define GPIO_POWER 97 +#define GPIO_IRQ IRQ_GPIO3 + #endif /* __MINIPC_H__ */ diff -r 5dc17c3c1773 -r 2f6e7237dbb5 stage2/board-minipc.c --- a/stage2/board-minipc.c Sat May 14 22:47:06 2016 +0200 +++ b/stage2/board-minipc.c Sat May 14 23:46:35 2016 +0200 @@ -4,7 +4,7 @@ * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, * Copyright (C) 2005-2006 Ingenic Semiconductor, * Copyright (C) Xiangfu Liu - * Copyright (C) 2015 Paul Boddie + * Copyright (C) 2015, 2016 Paul Boddie * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,6 +95,25 @@ __ost_clear_uf(TIMER_CHAN); } +/* GPIO interrupt activation. */ + +void gpio_init_irq() +{ +/* + unsigned int i; + for (i = 0; i < 7; i++) { + __gpio_as_irq_rise_edge(GPIO_KEYIN_BASE + i); + } +*/ + __gpio_as_irq_low_level(GPIO_POWER); + __intc_unmask_irq(GPIO_IRQ); +} + +int gpio_have_irq(u8 gpio) +{ + return (REG_GPIO_GPFR(gpio / 32) & (1 << (gpio % 32))); +} + /* Board startup detection. */ int is_started() diff -r 5dc17c3c1773 -r 2f6e7237dbb5 stage2/board-nanonote.c --- a/stage2/board-nanonote.c Sat May 14 22:47:06 2016 +0200 +++ b/stage2/board-nanonote.c Sat May 14 23:46:35 2016 +0200 @@ -4,7 +4,7 @@ * Copyright (C) 2000-2009 Wolfgang Denk, DENX Software Engineering, * Copyright (C) 2006 Ingenic Semiconductor, * Copyright (C) Xiangfu Liu - * Copyright (C) 2015 Paul Boddie + * Copyright (C) 2015, 2016 Paul Boddie * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,26 +172,6 @@ return (REG_GPIO_PXFLG(gpio / 32) & (1 << (gpio % 32))); } -void gpio_clear(u8 gpio) -{ - /* Clear interrupt status. */ - - __gpio_ack_irq(gpio); - __intc_ack_irq(GPIO_IRQ); -} - -/* Miscellaneous interrupt administration. */ - -void irq_clear() -{ - u8 i; - - for (i = 0; i < 32; i++) { - if (REG_INTC_IPR & (1 << i)) - __intc_ack_irq(i); - } -} - /* Board startup detection. */ int is_started() diff -r 5dc17c3c1773 -r 2f6e7237dbb5 stage2/board.c --- a/stage2/board.c Sat May 14 22:47:06 2016 +0200 +++ b/stage2/board.c Sat May 14 23:46:35 2016 +0200 @@ -3,7 +3,7 @@ * * Copyright (C) 2005-2006 Ingenic Semiconductor, * Copyright (C) Xiangfu Liu - * Copyright (C) 2015 Paul Boddie + * Copyright (C) 2015, 2016 Paul Boddie * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,7 +82,7 @@ timestamp = t; } -void udelay (unsigned long usec) +void udelay(unsigned long usec) { unsigned long tmo,tmp; @@ -111,7 +111,7 @@ while (get_timer_masked () < tmo); } -void udelay_masked (unsigned long usec) +void udelay_masked(unsigned long usec) { unsigned long tmo; unsigned long endtime; @@ -156,3 +156,25 @@ { return TIMER_HZ; } + +/* GPIO interrupt administration. */ + +void gpio_clear(u8 gpio) +{ + /* Clear interrupt status. */ + + __gpio_ack_irq(gpio); + __intc_ack_irq(GPIO_IRQ); +} + +/* Miscellaneous interrupt administration. */ + +void irq_clear() +{ + u8 i; + + for (i = 0; i < 32; i++) { + if (REG_INTC_IPR & (1 << i)) + __intc_ack_irq(i); + } +} diff -r 5dc17c3c1773 -r 2f6e7237dbb5 stage2/board.h --- a/stage2/board.h Sat May 14 22:47:06 2016 +0200 +++ b/stage2/board.h Sat May 14 23:46:35 2016 +0200 @@ -6,19 +6,39 @@ void udelay(unsigned long); unsigned long get_memory_size(); +/* Common timer definitions. */ + #define TIMER_HZ CONFIG_SYS_HZ #define TIMER_CHAN 0 #define TIMER_FDATA 0xffff /* timer full data value, limited to 16 bits */ +/* Select the CPU definitions according to the configuration. */ + #ifdef CONFIG_CPU_JZ4730 + #include "jz4730.h" #include "jz4730_compat.h" #define READ_TIMER __ost_get_count(TIMER_CHAN) /* macro to read the 32 bit timer */ #define TIMER_CHAN_IRQ IRQ_OST0 -#else + +#else /* assume jz4740 */ + #include "jz4740.h" #define READ_TIMER REG_TCU_TCNT(TIMER_CHAN) /* macro to read the 16 bit timer */ #define TIMER_CHAN_IRQ IRQ_TCU0 -#endif + +#endif /* CONFIG_CPU_JZ4730 */ + +/* Select the board definitions according to the configuration. */ + +#ifdef CONFIG_CPU_JZ4730_MINIPC + +#include "minipc.h" + +#else /* assume NanoNote */ + +#include "nanonote.h" + +#endif /* CONFIG_CPU_JZ4730_MINIPC */ #endif /* __BOARD_H__ */ diff -r 5dc17c3c1773 -r 2f6e7237dbb5 stage2/init.h --- a/stage2/init.h Sat May 14 22:47:06 2016 +0200 +++ b/stage2/init.h Sat May 14 23:46:35 2016 +0200 @@ -22,6 +22,7 @@ void gpio_clear(u8); /* General. */ + void irq_clear(); /* Test for initialisation. */