u-boot: add SPI, EEPROM and DTT support for mpc8313e-rdb
[openembedded.git] / packages / u-boot / u-boot-1.3.2 / mpc8313e-rdb-spi.patch
1 Index: u-boot-1.3.2/board/freescale/mpc8313erdb/mpc8313erdb.c
2 ===================================================================
3 --- u-boot-1.3.2.orig/board/freescale/mpc8313erdb/mpc8313erdb.c 2008-09-12 18:48:23.000000000 +0200
4 +++ u-boot-1.3.2/board/freescale/mpc8313erdb/mpc8313erdb.c      2008-09-12 18:50:10.000000000 +0200
5 @@ -28,6 +28,7 @@
6  #endif
7  #include <pci.h>
8  #include <mpc83xx.h>
9 +#include <spi.h> 
10  
11  DECLARE_GLOBAL_DATA_PTR;
12  
13 @@ -107,3 +108,33 @@
14  #endif
15  }
16  #endif
17 +
18 +
19 +/*
20 + * The following are used to control the SPI chip selects for the SPI command.
21 + */
22 +#ifdef CONFIG_HARD_SPI
23 +
24 +#define SPI_CS_MASK    0x80000000
25 +
26 +void spi_eeprom_chipsel(int cs)
27 +{
28 +       volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0];
29 +
30 +       if (cs)
31 +               iopd->dat &= ~SPI_CS_MASK;
32 +       else
33 +               iopd->dat |=  SPI_CS_MASK;
34 +}
35 +
36 +/*
37 + * The SPI command uses this table of functions for controlling the SPI
38 + * chip selects.
39 + */
40 +spi_chipsel_type spi_chipsel[] = {
41 +       spi_eeprom_chipsel,
42 +};
43 +int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
44 +
45 +#endif /* CONFIG_HARD_SPI */
46 +
47 Index: u-boot-1.3.2/include/configs/MPC8313ERDB.h
48 ===================================================================
49 --- u-boot-1.3.2.orig/include/configs/MPC8313ERDB.h     2008-09-12 18:50:09.000000000 +0200
50 +++ u-boot-1.3.2/include/configs/MPC8313ERDB.h  2008-09-12 18:50:50.000000000 +0200
51 @@ -359,6 +359,7 @@
52  #define CONFIG_CMD_DATE
53  #define CONFIG_CMD_PCI
54  #define CONFIG_CMD_NAND
55 +#define CONFIG_CMD_SPI
56  
57  #if defined(CFG_RAMBOOT)
58      #undef CONFIG_CMD_ENV
59 @@ -367,6 +368,11 @@
60  
61  #define CONFIG_CMDLINE_EDITING 1
62  
63 +/* SPI */
64 +#define CONFIG_MPC8XXX_SPI
65 +#define CONFIG_HARD_SPI                        /* SPI with hardware support */
66 +#undef CONFIG_SOFT_SPI                 /* SPI bit-banged */
67 +
68  /*
69   * JFFS2 partitions (mtdparts command line support)
70   */