diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sandbox/cpu/os.c | 5 | ||||
-rw-r--r-- | arch/sandbox/cpu/sdl.c | 30 | ||||
-rw-r--r-- | arch/sandbox/dts/sandbox.dts | 25 | ||||
-rw-r--r-- | arch/sandbox/dts/sandbox64.dts | 21 | ||||
-rw-r--r-- | arch/sandbox/dts/sandbox_pmic.dtsi | 71 | ||||
-rw-r--r-- | arch/sandbox/dts/test.dts | 28 |
6 files changed, 97 insertions, 83 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index aa92694342..62e05c554a 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -735,9 +735,10 @@ int os_find_u_boot(char *fname, int maxlen) } /* Look for 'u-boot' in the parent directory of spl/ */ - p = strstr(fname, "/spl/"); + p = strstr(fname, "spl/"); if (p) { - strcpy(p, p + 4); + /* Remove the "spl" characters */ + memmove(p, p + 4, strlen(p + 4) + 1); fd = os_open(fname, O_RDONLY); if (fd >= 0) { close(fd); diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index adcb73826f..c7a8d94549 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -9,6 +9,10 @@ #include <sound.h> #include <asm/state.h> +enum { + SAMPLE_RATE = 22050, +}; + static struct sdl_info { SDL_Surface *screen; int width; @@ -18,6 +22,7 @@ static struct sdl_info { uint frequency; uint audio_pos; uint audio_size; + uint sample_rate; uint8_t *audio_data; bool audio_active; bool inited; @@ -263,27 +268,8 @@ int sandbox_sdl_sound_init(void) if (sdl.audio_active) return 0; - /* - * At present all sandbox sounds crash. This is probably due to - * symbol name conflicts with U-Boot. We can remove the malloc() - * probles with: - * - * #define USE_DL_PREFIX - * - * and get this: - * - * Assertion 'e->pollfd->fd == e->fd' failed at pulse/mainloop.c:676, - * function dispatch_pollfds(). Aborting. - * - * The right solution is probably to make U-Boot's names private or - * link os.c and sdl.c against their libraries before liking with - * U-Boot. TBD. For now sound is disabled. - */ - printf("(Warning: sandbox sound disabled)\n"); - return 0; - /* Set the audio format */ - wanted.freq = 22050; + wanted.freq = SAMPLE_RATE; wanted.format = AUDIO_S16; wanted.channels = 1; /* 1 = mono, 2 = stereo */ wanted.samples = 1024; /* Good low-latency value for callback */ @@ -309,6 +295,7 @@ int sandbox_sdl_sound_init(void) goto err; } sdl.audio_active = true; + sdl.sample_rate = wanted.freq; return 0; @@ -322,7 +309,8 @@ int sandbox_sdl_sound_start(uint frequency) if (!sdl.audio_active) return -1; sdl.frequency = frequency; - sound_create_square_wave((unsigned short *)sdl.audio_data, + sound_create_square_wave(sdl.sample_rate, + (unsigned short *)sdl.audio_data, sdl.audio_size, frequency); sdl.audio_pos = 0; SDL_PauseAudio(0); diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 1cda911d1f..ce3c88c221 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -95,19 +95,11 @@ eeprom@2c { reg = <0x2c>; compatible = "i2c-eeprom"; - emul { - compatible = "sandbox,i2c-eeprom"; - sandbox,filename = "i2c.bin"; - sandbox,size = <128>; - }; }; rtc_0: rtc@43 { reg = <0x43>; compatible = "sandbox-rtc"; - emul { - compatible = "sandbox,i2c-rtc"; - }; }; sandbox_pmic: sandbox_pmic { reg = <0x40>; @@ -116,6 +108,23 @@ mc34708: pmic@41 { reg = <0x41>; }; + + i2c_emul: emul { + #address-cells = <1>; + #size-cells = <0>; + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul-eeprom { + reg = <0x2c>; + compatible = "sandbox,i2c-eeprom"; + sandbox,filename = "i2c.bin"; + sandbox,size = <256>; + }; + emul0 { + reg = <0x43>; + compatible = "sandbox,i2c-rtc"; + }; + }; }; lcd { diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index 2c6d351381..d30fd62a2a 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -90,19 +90,11 @@ eeprom@2c { reg = <0x2c>; compatible = "i2c-eeprom"; - emul { - compatible = "sandbox,i2c-eeprom"; - sandbox,filename = "i2c.bin"; - sandbox,size = <128>; - }; }; rtc_0: rtc@43 { reg = <0x43>; compatible = "sandbox-rtc"; - emul { - compatible = "sandbox,i2c-rtc"; - }; }; sandbox_pmic: sandbox_pmic { reg = <0x40>; @@ -111,6 +103,19 @@ mc34708: pmic@41 { reg = <0x41>; }; + + i2c_emul: emul { + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul-eeprom { + compatible = "sandbox,i2c-eeprom"; + sandbox,filename = "i2c.bin"; + sandbox,size = <256>; + }; + emul0 { + compatible = "sandbox,i2c-rtc"; + }; + }; }; lcd { diff --git a/arch/sandbox/dts/sandbox_pmic.dtsi b/arch/sandbox/dts/sandbox_pmic.dtsi index 5ecafaab36..565c382ed4 100644 --- a/arch/sandbox/dts/sandbox_pmic.dtsi +++ b/arch/sandbox/dts/sandbox_pmic.dtsi @@ -11,40 +11,6 @@ &sandbox_pmic { compatible = "sandbox,pmic"; - pmic_emul { - compatible = "sandbox,i2c-pmic"; - - /* - * Default PMICs register values are set by macro - * VAL2REG(min, step, value) [uV/uA] - * VAL2OMREG(mode id) - * reg-defaults - byte array - */ - reg-defaults = /bits/ 8 < - /* BUCK1 */ - VAL2REG(800000, 25000, 1000000) - VAL2REG(150000, 25000, 150000) - VAL2OMREG(BUCK_OM_OFF) - /* BUCK2 */ - VAL2REG(750000, 50000, 3000000) - VAL2REG(150000, 25000, 150000) - VAL2OMREG(0) - /* LDO1 */ - VAL2REG(800000, 25000, 1600000) - VAL2REG(100000, 50000, 150000) - VAL2OMREG(LDO_OM_OFF) - /* LDO2 */ - VAL2REG(750000, 50000, 3000000) - VAL2REG(150000, 25000, 150000) - VAL2OMREG(0) - /* reg[12:15] - not used */ - 0x00 - 0x00 - 0x00 - 0x00 - >; - }; - buck1 { regulator-name = "SUPPLY_1.2V"; regulator-min-microvolt = <1200000>; @@ -84,10 +50,45 @@ &mc34708 { compatible = "fsl,mc34708"; +}; - pmic_emul { +&i2c_emul { + emul_pmic0: pmic-emul0 { compatible = "sandbox,i2c-pmic"; + /* + * Default PMICs register values are set by macro + * VAL2REG(min, step, value) [uV/uA] + * VAL2OMREG(mode id) + * reg-defaults - byte array + */ + reg-defaults = /bits/ 8 < + /* BUCK1 */ + VAL2REG(800000, 25000, 1000000) + VAL2REG(150000, 25000, 150000) + VAL2OMREG(BUCK_OM_OFF) + /* BUCK2 */ + VAL2REG(750000, 50000, 3000000) + VAL2REG(150000, 25000, 150000) + VAL2OMREG(0) + /* LDO1 */ + VAL2REG(800000, 25000, 1600000) + VAL2REG(100000, 50000, 150000) + VAL2OMREG(LDO_OM_OFF) + /* LDO2 */ + VAL2REG(750000, 50000, 3000000) + VAL2REG(150000, 25000, 150000) + VAL2OMREG(0) + /* reg[12:15] - not used */ + 0x00 + 0x00 + 0x00 + 0x00 + >; + }; + + emul_pmic1: pmic-emul1 { + compatible = "sandbox,i2c-pmic"; reg-defaults = /bits/ 8 < 0x00 0x80 0x08 0xff 0xff 0xff 0x2e 0x01 0x08 0x40 0x80 0x81 0x5f 0xff 0xfb 0x1e 0x80 0x18 diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 2c6b422312..252aa7b6b6 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -266,35 +266,45 @@ eeprom@2c { reg = <0x2c>; compatible = "i2c-eeprom"; - emul { - compatible = "sandbox,i2c-eeprom"; - sandbox,filename = "i2c.bin"; - sandbox,size = <256>; - }; + sandbox,emul = <&emul_eeprom>; }; rtc_0: rtc@43 { reg = <0x43>; compatible = "sandbox-rtc"; - emul { - compatible = "sandbox,i2c-rtc"; - }; + sandbox,emul = <&emul0>; }; rtc_1: rtc@61 { reg = <0x61>; compatible = "sandbox-rtc"; - emul { + sandbox,emul = <&emul1>; + }; + + i2c_emul: emul { + reg = <0xff>; + compatible = "sandbox,i2c-emul-parent"; + emul_eeprom: emul-eeprom { + compatible = "sandbox,i2c-eeprom"; + sandbox,filename = "i2c.bin"; + sandbox,size = <256>; + }; + emul0: emul0 { + compatible = "sandbox,i2c-rtc"; + }; + emul1: emull { compatible = "sandbox,i2c-rtc"; }; }; sandbox_pmic: sandbox_pmic { reg = <0x40>; + sandbox,emul = <&emul_pmic0>; }; mc34708: pmic@41 { reg = <0x41>; + sandbox,emul = <&emul_pmic1>; }; }; |