[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/14] hw/misc/bcm2835_cprman: add a clock mux skeleton imple
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 09/14] hw/misc/bcm2835_cprman: add a clock mux skeleton implementation |
Date: |
Fri, 2 Oct 2020 17:34:51 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 10/2/20 4:42 PM, Philippe Mathieu-Daudé wrote:
> On 9/25/20 12:17 PM, Luc Michel wrote:
>> The clock multiplexers are the last clock stage in the cprman. Each mux
>> outputs one clock signal that goes out of the cprman to the SoC
>> peripherals.
>>
>> Each mux has at most 10 sources. The sources 0 to 3 are common to all
>> muxes. They are:
>> 0. ground (no clock signal)
>> 1. the main oscillator (xosc)
>> 2. "test debug 0" clock
>> 3. "test debug 1" clock
>>
>> Test debug 0 and 1 are actual clock muxes that can be used as sources to
>> other muxes (for debug purpose).
>>
>> Sources 4 to 9 are mux specific and can be unpopulated (grounded). Those
>> sources are fed by the PLL channels outputs.
>>
>> One corner case exists for DSI0E and DSI0P muxes. They have their source
>> number 4 connected to an intermediate multiplexer that can select
>> between PLLA-DSI0 and PLLD-DSI0 channel. This multiplexer is called
>> DSI0HSCK and is not a clock mux as such. It is really a simple mux from
>> the hardware point of view (see https://elinux.org/The_Undocumented_Pi).
>> This mux is not implemented in this commit.
>>
>> Note that there is some muxes for which sources are unknown (because of
>> a lack of documentation). For those cases all the sources are connected
>> to ground in this implementation.
>>
>> Each clock mux output is exported by the cprman at the qdev level,
>> adding the suffix '-out' to the mux name to form the output clock name.
>> (E.g. the 'uart' mux sees its output exported as 'uart-out' at the
>> cprman level.)
>>
>> Signed-off-by: Luc Michel <luc@lmichel.fr>
>> ---
[...]
>> struct BCM2835CprmanState {
>> /*< private >*/
>> SysBusDevice parent_obj;
>>
>> /*< public >*/
>> MemoryRegion iomem;
>>
>> CprmanPLLState plls[CPRMAN_NUM_PLL];
>> CprmanPLLChannelState channels[CPRMAN_NUM_PLL_CHANNEL];
>> + CprmanClockMuxState clock_muxes[CPRMAN_NUM_CLOCK_MUX];
>>
>> uint32_t regs[CPRMAN_NUM_REGS];
>> uint32_t xosc_freq;
>>
>> Clock *xosc;
>> + Clock *gnd;
>
> This one seems to belong to MachineState in "hw/boards.h".
Although it might be easier to have a singleton in hw/core/clock.c...