More accurate USB muxes.

This commit is contained in:
Dario Nieuwenhuis 2024-02-26 03:27:26 +01:00
parent d7462d805e
commit d67103f97f
8 changed files with 90 additions and 74 deletions

View File

@ -1626,11 +1626,11 @@ fieldset/CCIPR5:
bit_offset: 19 bit_offset: 19
bit_size: 3 bit_size: 3
enum: SAISEL enum: SAISEL
- name: CKPERSEL - name: PERSEL
description: per_ck clock source selection description: per_ck clock source selection
bit_offset: 30 bit_offset: 30
bit_size: 2 bit_size: 2
enum: CKPERSEL enum: PERSEL
fieldset/CFGR: fieldset/CFGR:
description: RCC clock configuration register description: RCC clock configuration register
fields: fields:
@ -2107,7 +2107,7 @@ fieldset/SECCFGR:
description: "Remove reset flag security\r Set and reset by software." description: "Remove reset flag security\r Set and reset by software."
bit_offset: 12 bit_offset: 12
bit_size: 1 bit_size: 1
- name: CKPERSELSEC - name: PERSELSEC
description: "per_ck selection security\r Set and reset by software." description: "per_ck selection security\r Set and reset by software."
bit_offset: 13 bit_offset: 13
bit_size: 1 bit_size: 1
@ -2144,18 +2144,6 @@ enum/CECSEL:
- name: CSI_DIV_122 - name: CSI_DIV_122
description: csi_ker_ck/122 selected as kernel clock description: csi_ker_ck/122 selected as kernel clock
value: 2 value: 2
enum/CKPERSEL:
bit_size: 2
variants:
- name: HSI
description: hsi_ker_ck selected as kernel clock (default after reset)
value: 0
- name: CSI
description: csi_ker_ck selected as kernel clock
value: 1
- name: HSE
description: hse_ck selected as kernel clock
value: 2
enum/DACHOLDSEL: enum/DACHOLDSEL:
bit_size: 1 bit_size: 1
variants: variants:
@ -2465,6 +2453,18 @@ enum/OCTOSPISEL:
- name: PER - name: PER
description: per_ck selected as kernel clock description: per_ck selected as kernel clock
value: 3 value: 3
enum/PERSEL:
bit_size: 2
variants:
- name: HSI
description: hsi_ker_ck selected as kernel clock (default after reset)
value: 0
- name: CSI
description: csi_ker_ck selected as kernel clock
value: 1
- name: HSE
description: hse_ck selected as kernel clock
value: 2
enum/PLLDIV: enum/PLLDIV:
bit_size: 7 bit_size: 7
variants: variants:

View File

@ -910,11 +910,11 @@ fieldset/CCIPR5:
bit_offset: 8 bit_offset: 8
bit_size: 2 bit_size: 2
enum: FDCANSEL enum: FDCANSEL
- name: CKPERSEL - name: PERSEL
description: per_ck clock source selection description: per_ck clock source selection
bit_offset: 30 bit_offset: 30
bit_size: 2 bit_size: 2
enum: CKPERSEL enum: PERSEL
fieldset/CFGR: fieldset/CFGR:
description: RCC clock configuration register description: RCC clock configuration register
fields: fields:
@ -1353,18 +1353,6 @@ enum/ADCDACSEL:
- name: CSI - name: CSI
description: csi_ker_ck selected as kernel clock description: csi_ker_ck selected as kernel clock
value: 5 value: 5
enum/CKPERSEL:
bit_size: 2
variants:
- name: HSI
description: hsi_ker_ck selected as kernel clock (default after reset)
value: 0
- name: CSI
description: csi_ker_ck selected as kernel clock
value: 1
- name: HSE
description: hse_ck selected as kernel clock
value: 2
enum/DACHOLDSEL: enum/DACHOLDSEL:
bit_size: 1 bit_size: 1
variants: variants:
@ -1644,6 +1632,18 @@ enum/MCOPRE:
- name: Div15 - name: Div15
description: Divide by 15 description: Divide by 15
value: 15 value: 15
enum/PERSEL:
bit_size: 2
variants:
- name: HSI
description: hsi_ker_ck selected as kernel clock (default after reset)
value: 0
- name: CSI
description: csi_ker_ck selected as kernel clock
value: 1
- name: HSE
description: hse_ck selected as kernel clock
value: 2
enum/PLLDIV: enum/PLLDIV:
bit_size: 7 bit_size: 7
variants: variants:

View File

@ -3081,11 +3081,11 @@ fieldset/D1CCIPR:
bit_offset: 16 bit_offset: 16
bit_size: 1 bit_size: 1
enum: SDMMCSEL enum: SDMMCSEL
- name: CKPERSEL - name: PERSEL
description: per_ck clock source selection description: per_ck clock source selection
bit_offset: 28 bit_offset: 28
bit_size: 2 bit_size: 2
enum: CKPERSEL enum: PERSEL
fieldset/D1CFGR: fieldset/D1CFGR:
description: RCC Domain 1 Clock Configuration Register description: RCC Domain 1 Clock Configuration Register
fields: fields:
@ -3541,18 +3541,6 @@ enum/CECSEL:
- name: CSI - name: CSI
description: csi_ker selected as peripheral clock description: csi_ker selected as peripheral clock
value: 2 value: 2
enum/CKPERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/DFSDMSEL: enum/DFSDMSEL:
bit_size: 1 bit_size: 1
variants: variants:
@ -3838,6 +3826,18 @@ enum/MCOPRE:
- name: Div15 - name: Div15
description: Divide by 15 description: Divide by 15
value: 15 value: 15
enum/PERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/PLLDIV: enum/PLLDIV:
bit_size: 7 bit_size: 7
variants: variants:

View File

@ -2027,11 +2027,11 @@ fieldset/D1CCIPR:
bit_offset: 16 bit_offset: 16
bit_size: 1 bit_size: 1
enum: SDMMCSEL enum: SDMMCSEL
- name: CKPERSEL - name: PERSEL
description: per_ck clock source selection description: per_ck clock source selection
bit_offset: 28 bit_offset: 28
bit_size: 2 bit_size: 2
enum: CKPERSEL enum: PERSEL
fieldset/D1CFGR: fieldset/D1CFGR:
description: RCC Domain 1 Clock Configuration Register description: RCC Domain 1 Clock Configuration Register
fields: fields:
@ -2455,18 +2455,6 @@ enum/CECSEL:
- name: CSI - name: CSI
description: csi_ker selected as peripheral clock description: csi_ker selected as peripheral clock
value: 2 value: 2
enum/CKPERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/DFSDMSEL: enum/DFSDMSEL:
bit_size: 1 bit_size: 1
variants: variants:
@ -2752,6 +2740,18 @@ enum/MCOPRE:
- name: Div15 - name: Div15
description: Divide by 15 description: Divide by 15
value: 15 value: 15
enum/PERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/PLLDIV: enum/PLLDIV:
bit_size: 7 bit_size: 7
variants: variants:

View File

@ -3064,11 +3064,11 @@ fieldset/D1CCIPR:
bit_offset: 16 bit_offset: 16
bit_size: 1 bit_size: 1
enum: SDMMCSEL enum: SDMMCSEL
- name: CKPERSEL - name: PERSEL
description: per_ck clock source selection description: per_ck clock source selection
bit_offset: 28 bit_offset: 28
bit_size: 2 bit_size: 2
enum: CKPERSEL enum: PERSEL
fieldset/D1CFGR: fieldset/D1CFGR:
description: RCC Domain 1 Clock Configuration Register description: RCC Domain 1 Clock Configuration Register
fields: fields:
@ -3524,18 +3524,6 @@ enum/CECSEL:
- name: CSI - name: CSI
description: csi_ker selected as peripheral clock description: csi_ker selected as peripheral clock
value: 2 value: 2
enum/CKPERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/DFSDMSEL: enum/DFSDMSEL:
bit_size: 1 bit_size: 1
variants: variants:
@ -3821,6 +3809,18 @@ enum/MCOPRE:
- name: Div15 - name: Div15
description: Divide by 15 description: Divide by 15
value: 15 value: 15
enum/PERSEL:
bit_size: 2
variants:
- name: HSI
description: HSI selected as peripheral clock
value: 0
- name: CSI
description: CSI selected as peripheral clock
value: 1
- name: HSE
description: HSE selected as peripheral clock
value: 2
enum/PLLDIV: enum/PLLDIV:
bit_size: 7 bit_size: 7
variants: variants:

View File

@ -285,6 +285,9 @@ impl ParsedRccs {
("I2C2", &["I2C1235"]), ("I2C2", &["I2C1235"]),
("I2C3", &["I2C1235"]), ("I2C3", &["I2C1235"]),
("I2C5", &["I2C1235"]), ("I2C5", &["I2C1235"]),
("USB", &["USB", "CLK48", "ICLK"]),
("USB_OTG_FS", &["USB", "CLK48", "ICLK"]),
("USB_OTG_HS", &["USB", "CLK48", "ICLK"]),
]; ];
let rcc = self.rccs.get(rcc_version)?; let rcc = self.rccs.get(rcc_version)?;
@ -315,7 +318,20 @@ impl ParsedRccs {
} }
rcc::KernelClock::Mux(mux.mux.clone()) rcc::KernelClock::Mux(mux.mux.clone())
} }
None => rcc::KernelClock::Clock(maybe_kernel_clock), None => {
if peri_name.starts_with("USB") {
if rcc_version.starts_with("f1") || rcc_version.starts_with("f3") {
maybe_kernel_clock = "USB".to_string();
} else if rcc_version.starts_with("f2") {
maybe_kernel_clock = "PLL1_Q".to_string();
} else if rcc_version.starts_with("l1") {
maybe_kernel_clock = "PLL1_VCO_DIV_2".to_string();
} else {
panic!("rcc_{}: peripheral {} missing mux", rcc_version, peri_name)
}
}
rcc::KernelClock::Clock(maybe_kernel_clock)
}
}; };
Some(peripheral::Rcc { Some(peripheral::Rcc {