summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/freescale/c29xpcie/ddr.c13
-rw-r--r--board/samsung/smdk5250/exynos5-dt.c2
-rw-r--r--board/samsung/trats/trats.c21
-rw-r--r--board/samsung/trats2/trats2.c35
-rw-r--r--board/sandbox/sandbox/README.sandbox54
5 files changed, 108 insertions, 17 deletions
diff --git a/board/freescale/c29xpcie/ddr.c b/board/freescale/c29xpcie/ddr.c
index 968655c..7c915b0 100644
--- a/board/freescale/c29xpcie/ddr.c
+++ b/board/freescale/c29xpcie/ddr.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <i2c.h>
#include <asm/fsl_law.h>
#include <fsl_ddr_sdram.h>
#include <fsl_ddr_dimm_params.h>
@@ -92,3 +93,15 @@ void fsl_ddr_board_options(memctl_options_t *popts,
popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
}
}
+
+void get_spd(generic_spd_eeprom_t *spd, u8 i2c_address)
+{
+ int ret = i2c_read(i2c_address, 0, 2, (uint8_t *)spd,
+ sizeof(generic_spd_eeprom_t));
+
+ if (ret) {
+ printf("DDR: failed to read SPD from address %u\n",
+ i2c_address);
+ memset(spd, 0, sizeof(generic_spd_eeprom_t));
+ }
+}
diff --git a/board/samsung/smdk5250/exynos5-dt.c b/board/samsung/smdk5250/exynos5-dt.c
index 6bcc883..6aa0509 100644
--- a/board/samsung/smdk5250/exynos5-dt.c
+++ b/board/samsung/smdk5250/exynos5-dt.c
@@ -150,8 +150,6 @@ int power_init_board(void)
set_ps_hold_ctrl();
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-
if (pmic_init(I2C_PMIC))
return -1;
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 6bd106e..8aba51c 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -57,15 +57,18 @@ int board_init(void)
void i2c_init_board(void)
{
- struct exynos4_gpio_part1 *gpio1 =
- (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+ int err;
struct exynos4_gpio_part2 *gpio2 =
(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
- /* I2C_5 -> PMIC -> Adapter 0 */
- s5p_gpio_direction_output(&gpio1->b, 7, 1);
- s5p_gpio_direction_output(&gpio1->b, 6, 1);
- /* I2C_9 -> FG -> Adapter 1 */
+ /* I2C_5 -> PMIC */
+ err = exynos_pinmux_config(PERIPH_ID_I2C5, PINMUX_FLAG_NONE);
+ if (err) {
+ debug("I2C%d not configured\n", (I2C_5));
+ return;
+ }
+
+ /* I2C_8 -> FG */
s5p_gpio_direction_output(&gpio2->y4, 0, 1);
s5p_gpio_direction_output(&gpio2->y4, 1, 1);
}
@@ -290,10 +293,10 @@ int power_init_board(void)
* The FUEL_GAUGE is marked as I2C9 on the schematic, but connected
* to logical I2C adapter 1
*/
- ret = pmic_init(I2C_0);
+ ret = pmic_init(I2C_5);
ret |= pmic_init_max8997();
- ret |= power_fg_init(I2C_1);
- ret |= power_muic_init(I2C_0);
+ ret |= power_fg_init(I2C_8);
+ ret |= power_muic_init(I2C_5);
ret |= power_bat_init(0);
if (ret)
return ret;
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 9552522..147de17 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -118,12 +118,17 @@ static void board_external_gpio_init(void)
#ifdef CONFIG_SYS_I2C_INIT_BOARD
static void board_init_i2c(void)
{
+ int err;
+
gpio1 = (struct exynos4x12_gpio_part1 *)samsung_get_base_gpio_part1();
gpio2 = (struct exynos4x12_gpio_part2 *)samsung_get_base_gpio_part2();
/* I2C_7 */
- s5p_gpio_direction_output(&gpio1->d0, 2, 1);
- s5p_gpio_direction_output(&gpio1->d0, 3, 1);
+ err = exynos_pinmux_config(PERIPH_ID_I2C7, PINMUX_FLAG_NONE);
+ if (err) {
+ debug("I2C%d not configured\n", (I2C_7));
+ return;
+ }
/* I2C_8 */
s5p_gpio_direction_output(&gpio1->f1, 4, 1);
@@ -135,6 +140,24 @@ static void board_init_i2c(void)
}
#endif
+#ifdef CONFIG_SYS_I2C_SOFT
+int get_soft_i2c_scl_pin(void)
+{
+ if (I2C_ADAP_HWNR)
+ return exynos4x12_gpio_part2_get_nr(m2, 1); /* I2C9 */
+ else
+ return exynos4x12_gpio_part1_get_nr(f1, 4); /* I2C8 */
+}
+
+int get_soft_i2c_sda_pin(void)
+{
+ if (I2C_ADAP_HWNR)
+ return exynos4x12_gpio_part2_get_nr(m2, 0); /* I2C9 */
+ else
+ return exynos4x12_gpio_part1_get_nr(f1, 5); /* I2C8 */
+}
+#endif
+
int board_early_init_f(void)
{
check_hw_revision();
@@ -170,11 +193,11 @@ int power_init_board(void)
#ifdef CONFIG_SYS_I2C_INIT_BOARD
board_init_i2c();
#endif
- pmic_init(I2C_0); /* I2C adapter 0 - bus name I2C_5 */
+ pmic_init(I2C_7); /* I2C adapter 7 - bus name s3c24x0_7 */
pmic_init_max77686();
- pmic_init_max77693(I2C_2); /* I2C adapter 2 - bus name I2C_10 */
- power_muic_init(I2C_2); /* I2C adapter 2 - bus name I2C_10 */
- power_fg_init(I2C_1); /* I2C adapter 1 - bus name I2C_9 */
+ pmic_init_max77693(I2C_9); /* I2C adapter 9 - bus name soft1 */
+ power_muic_init(I2C_9); /* I2C adapter 9 - bus name soft1 */
+ power_fg_init(I2C_8); /* I2C adapter 8 - bus name soft0 */
power_bat_init(0);
p_chrg = pmic_get("MAX77693_PMIC");
diff --git a/board/sandbox/sandbox/README.sandbox b/board/sandbox/sandbox/README.sandbox
index 30b0541..6989557 100644
--- a/board/sandbox/sandbox/README.sandbox
+++ b/board/sandbox/sandbox/README.sandbox
@@ -31,6 +31,60 @@ the console. It does not set the terminal into raw mode, so cursor keys and
history will not work yet.
+SPI Emulation
+-------------
+
+Sandbox supports SPI and SPI flash emulation.
+
+This is controlled by the spi_sf argument, the format of which is:
+
+ bus:cs:device:file
+
+ bus - SPI bus number
+ cs - SPI chip select number
+ device - SPI device emulation name
+ file - File on disk containing the data
+
+For example:
+
+ dd if=/dev/zero of=spi.bin bs=1M count=4
+ ./u-boot --spi_sf 0:0:M25P16:spi.bin
+
+With this setup you can issue SPI flash commands as normal:
+
+=>sf probe
+SF: Detected M25P16 with page size 64 KiB, total 2 MiB
+=>sf read 0 0 10000
+SF: 65536 bytes @ 0x0 Read: OK
+=>
+
+Since this is a full SPI emulation (rather than just flash), you can
+also use low-level SPI commands:
+
+=>sspi 0:0 32 9f
+FF202015
+
+This is issuing a READ_ID command and getting back 20 (ST Micro) part
+0x2015 (the M25P16).
+
+Drivers are connected to a particular bus/cs using sandbox's state
+structure (see the 'spi' member). A set of operations must be provided
+for each driver.
+
+
+Configuration settings for the curious are:
+
+CONFIG_SANDBOX_SPI_MAX_BUS
+ The maximum number of SPI buses supported by the driver (default 1).
+
+CONFIG_SANDBOX_SPI_MAX_CS
+ The maximum number of chip selects supported by the driver
+ (default 10).
+
+CONFIG_SPI_IDLE_VAL
+ The idle value on the SPI bus
+
+
Tests
-----