# HG changeset patch # User Paul Boddie # Date 1699834732 -3600 # Node ID 34c65d2fb03e2359c8fe4f725f6ae6675e1dd599 # Parent 7970787e99bd924837a762f5148b04d3d596ca95 Fixed GPC field definitions and added X1600 details. diff -r 7970787e99bd -r 34c65d2fb03e pkg/devices/lib/spi/src/jz4780.cc --- a/pkg/devices/lib/spi/src/jz4780.cc Mon Nov 13 01:17:58 2023 +0100 +++ b/pkg/devices/lib/spi/src/jz4780.cc Mon Nov 13 01:18:52 2023 +0100 @@ -1,5 +1,5 @@ /* - * Perform SPI communication using the JZ4780 SPI peripheral. + * Perform SPI communication using the JZ4780/X1600 SPI peripheral. * * Copyright (C) 2023 Paul Boddie * @@ -46,7 +46,8 @@ enum Ssi_data_bits : unsigned { - Ssi_data_gpc = 0x1000, + Ssi_data_gpc_set = 0x10000, + Ssi_data_gpc_unset = 0x00000, }; enum Ssi_control0_bits : unsigned @@ -68,7 +69,7 @@ Ssi_enable_recv_half_full = 0x02000, Ssi_enable_trans_error = 0x01000, Ssi_enable_recv_error = 0x00800, - Ssi_loop = 0x00400, + Ssi_loopback = 0x00400, Ssi_recv_finish_control = 0x00200, Ssi_recv_finished = 0x00100, Ssi_enable_auto_clear_underrun = 0x00080, @@ -100,6 +101,13 @@ Ssi_clock_stop_delay_plus_2 = 0x08000000, Ssi_clock_stop_delay_plus_3 = 0x0c000000, + /* X1600... */ + + Ssi_gpc_level_from_gpc_bit = 0x00000000, + Ssi_gpc_level_from_gpc_level = 0x02000000, + + /* Common... */ + Ssi_interval_assert_ce_or_ce2 = 0x01000000, Ssi_trans_empty_unfinished = 0x00800000, @@ -114,6 +122,12 @@ Ssi_recv_threshold_mask = 0x00000f00, Ssi_char_length_mask = 0x000000f8, + /* X1600... */ + + Ssi_gpc_level = 0x00000004, // see Ssi_gpc_level_from_gpc_level + + /* Common... */ + Spi_clock_assert_sample = 0x00000000, // phase #0 Spi_clock_assert_drive = 0x00000002, // phase #1 Spi_clock_idle_low_level = 0x00000000, // polarity #0 @@ -291,7 +305,7 @@ { /* Relocate the data/command level to bit 16. */ - uint32_t command = dc[transferred] ? (1 << 16) : 0; + uint32_t command = dc[transferred] ? Ssi_data_gpc_set : Ssi_data_gpc_unset; uint32_t value = data[transferred]; /* Combine the character with the data/command bit. */ @@ -326,7 +340,8 @@ /* Relocate any command bit to bit 16 for byte characters. */ - uint32_t command = (char_size < 16) && (value & (1 << char_size)) ? (1 << 16) : 0; + uint32_t command = (char_size < 16) && (value & (1 << char_size)) + ? Ssi_data_gpc_set : Ssi_data_gpc_unset; /* Combine the character portion of the unit with the command. */