]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
i.MX31: Make the SPI bus and chip select configurable for MC13783
authorMagnus Lilja <lilja.magnus@gmail.com>
Fri, 29 Aug 2008 08:36:18 +0000 (10:36 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Thu, 11 Sep 2008 23:23:44 +0000 (01:23 +0200)
The i.MX31 has three SPI buses and each bus has several chip selects
and the MC13783 chip can be connected to any of these. The current
RTC driver for MC13783 is hardcoded for CSPI2/SS2.

This patch makes make MC13783 SPI bus and chip select configurable
via CONFIG_MC13783_SPI_BUS and CONFIG_MC13783_SPI_CS.

Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
doc/README.mx31 [new file with mode: 0644]
drivers/rtc/mc13783-rtc.c
include/configs/imx31_litekit.h
include/configs/mx31ads.h

diff --git a/doc/README.mx31 b/doc/README.mx31
new file mode 100644 (file)
index 0000000..f912b66
--- /dev/null
@@ -0,0 +1,19 @@
+
+U-Boot for Freescale i.MX31
+
+This file contains information for the port of U-Boot to the Freescale
+i.MX31 SoC.
+
+1. CONFIGURATION OPTIONS/SETTINGS
+---------------------------------
+
+1.1 Configuration of MC13783 SPI bus
+------------------------------------
+The power management companion chip MC13783 is connected to the
+i.MX31 via an SPI bus. Use the following configuration options
+to setup the bus and chip select used for a particular board.
+
+CONFIG_MC13783_SPI_BUS -- defines the SPI bus the MC13783 is connected to.
+                          Note that 0 is CSPI1, 1 is CSPI2 and 2 is CSPI3.
+CONFIG_MC13783_SPI_CS  -- define the chip select the MC13783 s connected to.
+
index 6ea9137889709c0d2ddc931fa1072721babd32df..05db2f1d474ed9d6497a0f04dc15eb5316f31e32 100644 (file)
@@ -34,7 +34,8 @@ int rtc_get(struct rtc_time *rtc)
 
        if (!slave) {
                /* FIXME: Verify the max SCK rate */
-               slave = spi_setup_slave(1, 0, 1000000,
+               slave = spi_setup_slave(CONFIG_MC13783_SPI_BUS,
+                               CONFIG_MC13783_SPI_CS, 1000000,
                                SPI_MODE_2 | SPI_CS_HIGH);
                if (!slave)
                        return -1;
@@ -83,7 +84,8 @@ int rtc_set(struct rtc_time *rtc)
 
        if (!slave) {
                /* FIXME: Verify the max SCK rate */
-               slave = spi_setup_slave(1, 0, 1000000,
+               slave = spi_setup_slave(CONFIG_MC13783_SPI_BUS,
+                               CONFIG_MC13783_SPI_CS, 1000000,
                                SPI_MODE_2 | SPI_CS_HIGH);
                if (!slave)
                        return -1;
index c4763335b6e33999936916c1d7b14b4304cd2c31..62a03fac819c367b2839298dc784aae2b94c9b32 100644 (file)
@@ -69,6 +69,9 @@
 #define CONFIG_DEFAULT_SPI_MODE        (SPI_MODE_2 | SPI_CS_HIGH)
 
 #define CONFIG_RTC_MC13783     1
+/* MC13783 connected to CSPI2 and SS0 */
+#define CONFIG_MC13783_SPI_BUS 1
+#define CONFIG_MC13783_SPI_CS  0
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
index 9ede7645d9e1230d97cdf99caa35c8fe68b39e02..b9ad3e4af5f7feed386a250e3291dfaf41adfbf9 100644 (file)
@@ -66,6 +66,9 @@
 #define CONFIG_DEFAULT_SPI_MODE        (SPI_MODE_2 | SPI_CS_HIGH)
 
 #define CONFIG_RTC_MC13783     1
+/* MC13783 connected to CSPI2 and SS0 */
+#define CONFIG_MC13783_SPI_BUS 1
+#define CONFIG_MC13783_SPI_CS  0
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE