24.4.2017 22.54 "Mark Kettenis" <mark.kette...@xs4all.nl> kirjoitti:
On armv7 and arm64 we have this dirty hack to be able to use the com(4) driver on hardware blocks that have the registers spaced differently than the origional NS8250/16450/16550. One they I'm going to fix this properly in com(4) itself, but not today. Now on the Rockchip RK3288, the Synopsis Designware UART block is implemented in a way that only allows word-sized access. Byte-sized writes have no effect, and as a result the serial console remains silent. The diff below changes the "quadruple" bus space access methonds to do word-size access. This seems to work fine on an Allwinner H3 and Raspberry Pi 3. It would be good if someone could test this on a BeagleBone Black or some other TI board. ok? Index: arch/arm/armv7/armv7_a4x_io.S =================================================================== RCS file: /cvs/src/sys/arch/arm/armv7/armv7_a4x_io.S,v retrieving revision 1.1 diff -u -p -r1.1 armv7_a4x_io.S --- arch/arm/armv7/armv7_a4x_io.S 8 May 2009 02:57:32 -0000 1.1 +++ arch/arm/armv7/armv7_a4x_io.S 24 Apr 2017 18:56:08 -0000 @@ -50,12 +50,11 @@ */ ENTRY(a4x_bs_r_1) - ldrb r0, [r1, r2, LSL #2] + ldr r0, [r1, r2, LSL #2] mov pc, lr ENTRY(a4x_bs_r_2) - mov r2, r2, LSL #2 - ldrh r0, [r1, r2] + ldr r0, [r1, r2, LSL #2] mov pc, lr ENTRY(a4x_bs_r_4) @@ -67,12 +66,11 @@ ENTRY(a4x_bs_r_4) */ ENTRY(a4x_bs_w_1) - strb r3, [r1, r2, LSL #2] + str r3, [r1, r2, LSL #2] mov pc, lr ENTRY(a4x_bs_w_2) - mov r2, r2, LSL #2 - strh r3, [r1, r2] + str r3, [r1, r2, LSL #2] mov pc, lr ENTRY(a4x_bs_w_4) Index: arch/arm64/dev/arm64_bus_space.c =================================================================== RCS file: /cvs/src/sys/arch/arm64/dev/arm64_bus_space.c,v retrieving revision 1.3 diff -u -p -r1.3 arm64_bus_space.c --- arch/arm64/dev/arm64_bus_space.c 17 Feb 2017 19:20:22 -0000 1.3 +++ arch/arm64/dev/arm64_bus_space.c 24 Apr 2017 18:56:08 -0000 @@ -262,13 +262,13 @@ generic_space_vaddr(bus_space_tag_t t, b uint8_t a4x_space_read_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) { - return *(volatile uint8_t *)(h + (o*4)); + return *(volatile uint32_t *)(h + (o*4)); } uint16_t a4x_space_read_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) { - return *(volatile uint16_t *)(h + (o*4)); + return *(volatile uint32_t *)(h + (o*4)); } uint32_t @@ -287,14 +287,14 @@ void a4x_space_write_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint8_t v) { - *(volatile uint8_t *)(h + (o*4)) = v; + *(volatile uint32_t *)(h + (o*4)) = v; } void a4x_space_write_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, uint16_t v) { - *(volatile uint16_t *)(h + (o*4)) = v; + *(volatile uint32_t *)(h + (o*4)) = v; } void Fwiw.(not much) I used to run w/diff like above, and had np, maybe this was for xscale or something i never tested with.. -aalm