From 6b838ee479606ba6f38f8743c1b749c02f9af8dc Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 22 Jul 2012 10:45:19 -0300 Subject: [PATCH] avrdude/: support use of CLK for regular I/O --- avrdude/patches/nanonote-nxuart.patch | 6 +++--- avrdude/patches/nanonote.patch | 28 +++++++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/avrdude/patches/nanonote-nxuart.patch b/avrdude/patches/nanonote-nxuart.patch index 80998fe..d92f108 100644 --- a/avrdude/patches/nanonote-nxuart.patch +++ b/avrdude/patches/nanonote-nxuart.patch @@ -1,7 +1,7 @@ Index: avrdude-5.11.1/avrdude.conf.in =================================================================== ---- avrdude-5.11.1.orig/avrdude.conf.in 2012-07-22 10:29:39.039644015 -0300 -+++ avrdude-5.11.1/avrdude.conf.in 2012-07-22 10:29:56.504217803 -0300 +--- avrdude-5.11.1.orig/avrdude.conf.in 2012-07-22 10:46:06.492107995 -0300 ++++ avrdude-5.11.1/avrdude.conf.in 2012-07-22 10:50:05.607975349 -0300 @@ -713,6 +713,29 @@ type = avr910; ; @@ -12,7 +12,7 @@ Index: avrdude-5.11.1/avrdude.conf.in +# DAT1 1 +# DAT0 2 +# VSS - -+# CLK - (reserved for clock output) ++# CLK 4 (also used for clock output) +# VDD - +# CMD 6 +# DAT3 7 diff --git a/avrdude/patches/nanonote.patch b/avrdude/patches/nanonote.patch index 1a1944f..8848414 100644 --- a/avrdude/patches/nanonote.patch +++ b/avrdude/patches/nanonote.patch @@ -1,7 +1,7 @@ Index: avrdude-5.11.1/Makefile.am =================================================================== ---- avrdude-5.11.1.orig/Makefile.am 2012-07-22 09:49:20.000000000 -0300 -+++ avrdude-5.11.1/Makefile.am 2012-07-22 10:02:19.377565182 -0300 +--- avrdude-5.11.1.orig/Makefile.am 2012-07-22 10:38:55.281926086 -0300 ++++ avrdude-5.11.1/Makefile.am 2012-07-22 10:39:01.946145199 -0300 @@ -118,6 +118,8 @@ lists.c \ lists.h \ @@ -13,8 +13,8 @@ Index: avrdude-5.11.1/Makefile.am pgm.c \ Index: avrdude-5.11.1/config_gram.y =================================================================== ---- avrdude-5.11.1.orig/config_gram.y 2012-07-22 10:02:14.000000000 -0300 -+++ avrdude-5.11.1/config_gram.y 2012-07-22 10:02:59.782902697 -0300 +--- avrdude-5.11.1.orig/config_gram.y 2012-07-22 10:38:55.261925424 -0300 ++++ avrdude-5.11.1/config_gram.y 2012-07-22 10:39:01.946145199 -0300 @@ -50,6 +50,7 @@ #include "jtagmkI.h" #include "jtagmkII.h" @@ -46,8 +46,8 @@ Index: avrdude-5.11.1/config_gram.y current_prog->desc[PGM_DESCLEN-1] = 0; Index: avrdude-5.11.1/lexer.l =================================================================== ---- avrdude-5.11.1.orig/lexer.l 2012-07-22 09:49:20.000000000 -0300 -+++ avrdude-5.11.1/lexer.l 2012-07-22 10:02:19.377565182 -0300 +--- avrdude-5.11.1.orig/lexer.l 2012-07-22 10:38:55.269925685 -0300 ++++ avrdude-5.11.1/lexer.l 2012-07-22 10:39:01.946145199 -0300 @@ -168,6 +168,7 @@ min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; } miso { yylval=NULL; return K_MISO; } @@ -59,8 +59,8 @@ Index: avrdude-5.11.1/lexer.l Index: avrdude-5.11.1/nanonote.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ avrdude-5.11.1/nanonote.c 2012-07-22 10:02:19.377565182 -0300 -@@ -0,0 +1,374 @@ ++++ avrdude-5.11.1/nanonote.c 2012-07-22 10:44:40.605282695 -0300 +@@ -0,0 +1,378 @@ +/* + * avrdude - A Downloader/Uploader for AVR device programmers + * Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean @@ -129,13 +129,15 @@ Index: avrdude-5.11.1/nanonote.c + { 3, 11 }, /* 1: PD11, DAT1 */ + { 3, 10 }, /* 2: PD12, DAT0 */ + { 0, 0 }, /* 3: VSS */ -+ { 0, 0 }, /* 4: PD09, CLK (reserved) */ ++ { 3, 9 }, /* 4: PD09, CLK (also used for clock output) */ + { 0, 0 }, /* 5: VDD */ + { 3, 8 }, /* 6: PD08, CMD */ + { 3, 13 }, /* 7: PD13, DAT3 */ + { 3, 12 } /* 8: PD13, DAT2 */ +}; + ++#define PIN_IDX_CLK 4 ++ + +#define BASE 0x10000000 +#define REG_WINDOW 0x30000 @@ -251,6 +253,8 @@ Index: avrdude-5.11.1/nanonote.c + return -1; + if (!pin_map[pin].port) + return -1; ++ if (pin == PIN_IDX_CLK && PDATA(pgm)->clk) ++ return -1; + + gpio_input(pin_map[pin].port, pin_map[pin].bit); /* @@@ hack */ + v = gpio_get(pin_map[pin].port, pin_map[pin].bit); @@ -282,6 +286,8 @@ Index: avrdude-5.11.1/nanonote.c + gpio_high(CMD); + gpio_high(DAT3); + gpio_high(DAT2); ++ gpio_function(CLK, 0); /* set CLK to GPIO */ ++ gpio_high(CLK); +} + + @@ -325,8 +331,6 @@ Index: avrdude-5.11.1/nanonote.c +static void nanonote_disable(PROGRAMMER *pgm) +{ + misc_high(pgm); -+ gpio_function(CLK, 0); /* set CLK to GPIO */ -+ gpio_high(CLK); +} + + @@ -438,7 +442,7 @@ Index: avrdude-5.11.1/nanonote.c Index: avrdude-5.11.1/nanonote.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ avrdude-5.11.1/nanonote.h 2012-07-22 10:02:19.377565182 -0300 ++++ avrdude-5.11.1/nanonote.h 2012-07-22 10:39:01.946145199 -0300 @@ -0,0 +1,6 @@ +#ifndef nanonote_h +#define nanonote_h