From 15e476bc8dcadb88cad1e593e22cbeca62d05edb Mon Sep 17 00:00:00 2001 From: Leo C Date: Fri, 5 Dec 2014 00:09:29 +0100 Subject: [PATCH] Card detect over cs pin: clean initialisation/power up --- avr/cmd_sd.c | 8 +-- avr/gpio.c | 55 +++++++++++---------- avr/main.c | 15 ++---- avr/mmc.c | 135 +++++++++++++++++++++++++++++++-------------------- 4 files changed, 118 insertions(+), 95 deletions(-) diff --git a/avr/cmd_sd.c b/avr/cmd_sd.c index f43725a..46dbcfd 100644 --- a/avr/cmd_sd.c +++ b/avr/cmd_sd.c @@ -330,18 +330,18 @@ CMD_TBL_ITEM( ), CMD_TBL_ITEM( dump, CONFIG_SYS_MAXARGS, 1, do_dump, - "Dump sector", - "" + "Dump sector(s)", + " [sector [count ]]" ), CMD_TBL_ITEM( read, 2, 1, do_read, "Read disk sector(s) into meomory", - "drive [sector [count [memaddr]]]" + " [sector [count [memaddr]]]" ), CMD_TBL_ITEM( write, 2, 1, do_write, "Write sector(s) from meomory to disk", - "drive [sector [count [memaddr]]]" + " [sector [count [memaddr]]]" ), CMD_TBL_ITEM( sync, 2, 1, do_ioctl_sync, diff --git a/avr/gpio.c b/avr/gpio.c index 3c47247..31dbc21 100644 --- a/avr/gpio.c +++ b/avr/gpio.c @@ -7,36 +7,35 @@ /* -Pin Name Port Timer Mode max div max div min f [Hz] ----------------------------------------------------------------------------------- -0 PG5 OC0B PWM (2**8)*1024 262144 70.31 -1 PG4 -2 CLK2 PB4 OC2A Toggle (2**8)*1024*2 524288 35.16 -3 ZCLK PB5 OC1A PWM (2**16)*1024 67108864 0.2746 -4 PB6 OC1B PWM (2**16)*1024 67108864 0.2746 -5 PB7 OC0A Toggle (2**8)*1024*2 524288 35.16 -6 PG3 -7 PG2 -8 PG1 -9 PG0 -10 CLKO PE7 - - -pre Timer0 Timer1 Timer2 +Pin Name Port Timer Mode max div max div min f [Hz] +-------------------------------------------------------------------------------- +0 PG5 OC0B PWM (2**8)*1024 262144 70.31 +1 PG4 +2 CLK2 PB4 OC2A Toggle (2**8)*1024*2 524288 35.16 +3 ZCLK PB5 OC1A PWM (2**16)*1024 67108864 0.2746 +4 PB6 OC1B PWM (2**16)*1024 67108864 0.2746 +5 PB7 OC0A Toggle (2**8)*1024*2 524288 35.16 +6 PG3 +7 PG2 +8 PG1 +9 PG0 +10 CLKO PE7 +-------------------------------------------------------------------------------- + + +pre Timer0 Timer1 Timer2 -------------------------------------------------- -0 0 0 0 -1 1 1 1 -2 8 x8 8 x8 8 x8 -3 64 x8 64 x8 32 x4 -4 256 x4 256 x4 64 x2 -5 1024 x4 1024 x4 128 x2 -6 256 x2 -7 1024 x4 +0 0 0 0 +1 1 1 1 +2 8 x8 8 x8 8 x8 +3 64 x8 64 x8 32 x4 +4 256 x4 256 x4 64 x2 +5 1024 x4 1024 x4 128 x2 +6 256 x2 +7 1024 x4 -------------------------------------------------- - */ - #define PWMTOGGLE 0b01 #define PWMPOS 0b10 #define PWMNEG 0b11 @@ -312,7 +311,7 @@ int gpio_clockdiv_set(int pin, unsigned long divider) top = ltop - 1; - PING |= _BV(0); /* Debug */ +// PING |= _BV(0); /* Debug */ switch (timertype & TIMER) { case TIMER0: @@ -363,7 +362,7 @@ int gpio_clockdiv_set(int pin, unsigned long divider) break; } - PING |= _BV(0); /* Debug */ +// PING |= _BV(0); /* Debug */ gpio_config(pin, OUTPUT_TIMER); diff --git a/avr/main.c b/avr/main.c index 8acf265..f601736 100644 --- a/avr/main.c +++ b/avr/main.c @@ -18,7 +18,6 @@ #include "cli.h" #include "env.h" #include "z180-serv.h" -#include "spi.h" #include "gpio.h" #include "time.h" #include "rtc.h" @@ -112,13 +111,6 @@ void setup_avr(void) TCCR3B = (0b01<