]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
at91sam9/at91cap: spi init add hardware chip select support
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Fri, 27 Mar 2009 12:14:52 +0000 (13:14 +0100)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sat, 4 Apr 2009 18:42:17 +0000 (20:42 +0200)
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
cpu/arm926ejs/at91/at91cap9_spi.c
cpu/arm926ejs/at91/at91sam9260_spi.c
cpu/arm926ejs/at91/at91sam9261_spi.c
cpu/arm926ejs/at91/at91sam9263_spi.c
cpu/arm926ejs/at91/at91sam9rl_spi.c

index 356a804f79093c8073ef4899df94794d2a6fd863..cd8143bdfec37c50ba29f337d5067f7a9f7e64fc 100644 (file)
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI0);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PA5, 1);
+               at91_set_B_periph(AT91_PIN_PA5, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PA3, 1);
+               at91_set_B_periph(AT91_PIN_PA3, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PD0, 1);
+               at91_set_B_periph(AT91_PIN_PD0, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_B_periph(AT91_PIN_PD1, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PA5, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PA3, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PD0, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PD1, 1);
        }
 }
@@ -61,15 +73,28 @@ void at91_spi1_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI1);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PB15, 1);
+               at91_set_A_periph(AT91_PIN_PB15, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PB16, 1);
+               at91_set_A_periph(AT91_PIN_PB16, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PB17, 1);
+               at91_set_A_periph(AT91_PIN_PB17, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_A_periph(AT91_PIN_PB18, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PB15, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PB16, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PB17, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PB18, 1);
        }
+
 }
index 0105072daa701241ddd6bbb03918e90c4d1c99db..d6fd80ea7a122df5c812ede74cff8d3a3842996a 100644 (file)
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI0);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PA3, 1);
+               at91_set_A_periph(AT91_PIN_PA3, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PC11, 1);
+               at91_set_B_periph(AT91_PIN_PC11, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PC16, 1);
+               at91_set_B_periph(AT91_PIN_PC16, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_B_periph(AT91_PIN_PC17, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PA3, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PC11, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PC16, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PC17, 1);
        }
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI1);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PB3, 1);
+               at91_set_A_periph(AT91_PIN_PB3, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PC5, 1);
+               at91_set_B_periph(AT91_PIN_PC5, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PC4, 1);
+               at91_set_B_periph(AT91_PIN_PC4, 1);
        }
        if (cs_mask & (1 << 3)) {
                at91_set_gpio_output(AT91_PIN_PC3, 1);
        }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PB3, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PC5, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PC4, 1);
+       }
+       if (cs_mask & (1 << 7)) {
+               at91_set_gpio_output(AT91_PIN_PC3, 1);
+       }
 }
index f70320d7cdb605045a914983802dcd24b7eea24b..9383dc67db9ba53666269dd01d2c6cc3ec2acee3 100644 (file)
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI0);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PA3, 1);
+               at91_set_A_periph(AT91_PIN_PA3, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PA4, 1);
+               at91_set_A_periph(AT91_PIN_PA4, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PA5, 1);
+               at91_set_A_periph(AT91_PIN_PA5, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_A_periph(AT91_PIN_PA6, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PA3, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PA4, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PA5, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PA6, 1);
        }
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI1);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PB28, 1);
+               at91_set_A_periph(AT91_PIN_PB28, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PA24, 1);
+               at91_set_B_periph(AT91_PIN_PA24, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PA25, 1);
+               at91_set_B_periph(AT91_PIN_PA25, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_A_periph(AT91_PIN_PA26, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PB28, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PA24, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PA25, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PA26, 1);
        }
 }
index 1dda04c97469ea39fdb310ad7b1346278a8f87fa..e52dd61415ffbbf3fa1e0767f2bfde70458db744 100644 (file)
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI0);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PA5, 1);
+               at91_set_B_periph(AT91_PIN_PA5, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PA3, 1);
+               at91_set_B_periph(AT91_PIN_PA3, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PA4, 1);
+               at91_set_B_periph(AT91_PIN_PA4, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_B_periph(AT91_PIN_PB11, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PA5, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PA3, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PA4, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PB11, 1);
        }
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI1);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PB15, 1);
+               at91_set_A_periph(AT91_PIN_PB15, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PB16, 1);
+               at91_set_A_periph(AT91_PIN_PB16, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PB17, 1);
+               at91_set_A_periph(AT91_PIN_PB17, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_A_periph(AT91_PIN_PB18, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PB15, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PB16, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PB17, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PB18, 1);
        }
 }
index aa9c183172ba7a040b628d7eba4c06fe00c7eecf..389d6d80dd8fc6b28530509b2c458098e5743b06 100644 (file)
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
        at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);
 
        if (cs_mask & (1 << 0)) {
-               at91_set_gpio_output(AT91_PIN_PA28, 1);
+               at91_set_A_periph(AT91_PIN_PA28, 1);
        }
        if (cs_mask & (1 << 1)) {
-               at91_set_gpio_output(AT91_PIN_PB7, 1);
+               at91_set_B_periph(AT91_PIN_PB7, 1);
        }
        if (cs_mask & (1 << 2)) {
-               at91_set_gpio_output(AT91_PIN_PD8, 1);
+               at91_set_A_periph(AT91_PIN_PD8, 1);
        }
        if (cs_mask & (1 << 3)) {
+               at91_set_B_periph(AT91_PIN_PD9, 1);
+       }
+       if (cs_mask & (1 << 4)) {
+               at91_set_gpio_output(AT91_PIN_PA28, 1);
+       }
+       if (cs_mask & (1 << 5)) {
+               at91_set_gpio_output(AT91_PIN_PB7, 1);
+       }
+       if (cs_mask & (1 << 6)) {
+               at91_set_gpio_output(AT91_PIN_PD8, 1);
+       }
+       if (cs_mask & (1 << 7)) {
                at91_set_gpio_output(AT91_PIN_PD9, 1);
        }
 }