Commit graph

350 commits

Author SHA1 Message Date
CTCaer
b6384d5da5 bdk: utils: Set format attribute for s_printf
This allows the custom sprintf to be recognized as printf by gcc and effectively doing format checking.

NOTE: 64bit formatting is not supported for now, even if gcc asks to be set.
2022-05-12 16:40:34 +03:00
CTCaer
54b054c940 bdk: usb: add Sio support to hid gadget 2022-05-09 06:10:49 +03:00
CTCaer
f31170bb51 bdk: joycon: add Sio support (for Hoag) 2022-05-09 06:09:06 +03:00
CTCaer
f452d916c9 bdk: clock: add ext peripheral clock control 2022-05-09 06:08:39 +03:00
CTCaer
47d06d0e8a bdk: joycon: use flow control to improve packet integrity 2022-05-09 05:55:06 +03:00
CTCaer
2aed1b3b83 bdk: joycon: add 3 mbaud support and full init
Additionally use states for proper init
2022-05-09 05:48:10 +03:00
CTCaer
12aac3a0fc bdk: clock: add 3 megabaud support for UART 2022-05-09 05:47:08 +03:00
CTCaer
833a115eb2 bdk: joycon: improve and streamline jc detect 2022-05-09 05:39:45 +03:00
CTCaer
9f30c51bd1 bdk: joycon: refactor driver 2022-05-09 05:32:32 +03:00
CTCaer
f7bf4af3ec bdk: uart: refactor and add new functionality
- Allow to set CTS/RTS mode (only specific combos supported for now)
- Support the above modes in receiving
- Set 2 stop bits to decreases errors on high baudrates
2022-05-08 05:45:16 +03:00
CTCaer
ebe7b5a603 bdk: utils: add approx. square root calc for u64 2022-05-08 05:27:05 +03:00
CTCaer
ebf0db77ee bdk: sprintf: add negative number support for %d
This will now force a number as negative if bit31 is set and properly create the relevant string.

That means that external handling in order to show sign is now not needed.
2022-05-08 05:26:01 +03:00
CTCaer
81730c5f7e bdk: pinmux/pmc: add more defines 2022-05-08 05:22:41 +03:00
CTCaer
76d1b4e221 bdk: sdmmc: refactor defines
And fix a bug with tuning trim values
2022-05-08 05:21:29 +03:00
CTCaer
4a1cb1f2ea bdk: fan: add Hoag and Aula SKUs support
Now that what was hanging Aula is found (using PWM with its clock disabled), add full support for fan control on both SKUs.
2022-05-08 05:07:38 +03:00
CTCaer
58a2094448 bdk: reg 5v: add support for Hoag and Aula SKUs
Add support back and make it more proper.
Also add fan regulator support also.
2022-05-08 05:05:39 +03:00
CTCaer
37de367fef bdk: sdram: deduplicate dram configs
Additionally add info about new hynix chip and correct ids 3 and 5 on T210B01 based Switch.
2022-05-08 04:58:36 +03:00
CTCaer
450d95e573 bdk: di: correct samsung backlight set
Now that vblank writes are fixed we can return to proper backlight set.

Additionally, account for the pwm smoothing when backlight is turned off. That's to avoid visible green tint glitches when display is also turned off.
2022-05-08 04:53:13 +03:00
CTCaer
969a49edba bdk: di: reselect winA when done with winD config 2022-05-08 04:49:28 +03:00
CTCaer
9908eb8bb3 bdk: di: samsung panel: better init
- Set display color profile to natural (it's still vivid but not overblown.)
- Enable PWM slope and set it to 6 frames in order to have smooth backlight transitions
2022-05-08 04:48:55 +03:00
CTCaer
56dcbb2b23 bdk: di: cleanup configs
Nintendo or Nvidia copied pasted the dynamic display code into static arrays in order to do the static hw init in bootloader and boot sysmodule.

Ofc that does double the work that is not needed at all, making it suboptimal.

Clean up every single config based on how tegra display interface hw works in order to save up space and make the process a bit faster.
2022-05-08 04:45:03 +03:00
CTCaer
b9f40fed7a bdk: di: move plld setup code out of display obj 2022-05-08 04:41:05 +03:00
CTCaer
6ae4904c8f bdk: di: make dsi normal/vblank writes more robust 2022-05-08 04:36:20 +03:00
CTCaer
dd2bb0f555 bdk: di: refractor configs 2022-05-08 04:34:44 +03:00
CTCaer
0b8cdaf0ea bdk: di: split normal and vblank dsi reads
And also make vblank reads more robust
2022-05-08 04:23:31 +03:00
CTCaer
83c95d8a3b bdk: sdram: update 20/21/22 ids for new dram
Dram chip is Samsung 4GB built on 1z-nm that allows for 40% lower power usage.
2022-03-23 02:20:55 +02:00
CTCaer
ff214f25c1 bdk: update l4t hekatf prep functions 2022-03-23 00:58:20 +02:00
CTCaer
0fef90dc4c bdk: sd: return proper error for sd file save 2022-02-15 00:36:23 +02:00
CTCaer
ee465b98af bdk: sdmmc correct exit on eMMC < 4.0 modules 2022-02-15 00:24:53 +02:00
CTCaer
83b895a062 bdk: heap: improvements
Correct types everywhere.
Add BDK_MALLOC_NO_DEFRAG that disables defragmentation on the heap.
2022-02-15 00:22:38 +02:00
CTCaer
ce8d1eca91 bdk: remove sd mounts from ianos and check if sd is mounted in sd ops 2022-02-15 00:17:53 +02:00
CTCaer
3f65a30b2e bdk: more atf prep 2022-02-15 00:14:53 +02:00
CTCaer
7c74391754 bdk: bpmp: do not use full maintenance
Instead use proper clean/invalidation of dcache.
2022-02-15 00:14:14 +02:00
CTCaer
52bb6a96e5 bdk: nx emmc bis: fix out of cluster bounds accesses 2022-01-29 01:40:38 +02:00
CTCaer
6666dd4b46 bdk: fatfs: better PrFILE2 SAFE record creation 2022-01-29 01:40:05 +02:00
CTCaer
3fdb72ce37 bdk: i2c: correct order of spinlock wait 2022-01-29 01:34:01 +02:00
CTCaer
9a80f8b4b5 bdk: minerva: fix fsp op/wr check for l4t 2022-01-29 01:31:28 +02:00
CTCaer
ef5790cc2c bdk: mc: always on ahb arbitration
- Removed disables
- SDMMC code now just checks if it has access
2022-01-29 01:29:02 +02:00
CTCaer
7bb8b1da62 di: restore window config wait for inv pitch and block linear 2022-01-29 01:26:00 +02:00
CTCaer
192a936a31 bdk: add NX eMMC BIS driver 2022-01-20 13:21:04 +02:00
CTCaer
8327de8e2e bdk: replace NYX flag with proper flags
- BDK_MINERVA_CFG_FROM_RAM: enables support for getting minerva configuration from nyx storage
- BDK_HW_EXTRA_DEINIT: enables extra deinit in hw_reinit_workaround
- BDK_SDMMC_OC_AND_EXTRA_PRINT: enables eMMC OC support (533 MB/s) and extra error printing
2022-01-20 13:19:48 +02:00
CTCaer
960f3b23e7 bdk: ums: adhere to emmc ops changes also 2022-01-20 13:17:55 +02:00
CTCaer
b08e36a7b0 bdk: add emmc ops
- Add support for lower eMMC bus speed init in case of failures
- Add error count reporting
- Function names and defines changed from nx_emmc to emmc (except autorcm helper function)
- Enabling emuMMC support needs BDK_EMUMMC_ENABLE flag passed over
2022-01-20 13:14:38 +02:00
CTCaer
00110a8863 bdk: move sd ops into bdk 2022-01-20 12:48:41 +02:00
CTCaer
7ae4fd03c2 bdk: minerva: prep for ATF direct boot support 2022-01-20 12:43:24 +02:00
CTCaer
e071fe44b0 bdk: ini: reduce heap fragmentation/pressure 2022-01-20 12:41:20 +02:00
CTCaer
39d411dc68 bdk: uart: add uart va print 2022-01-20 12:39:32 +02:00
CTCaer
82f90fae28 bdk: utils: add vprintf 2022-01-20 12:37:41 +02:00
CTCaer
10e1f67dc5 bdk: utils: add strcpy with head/tail whitespace removal 2022-01-20 12:36:25 +02:00
CTCaer
10b479dc1c bdk: clock: add apb/ahb clock control 2022-01-20 12:32:57 +02:00
CTCaer
3dd12321f8 bdk: add activity monitor driver 2022-01-20 12:32:02 +02:00
CTCaer
c1441a64c7 bdk: se: expose xts functions and add nx xts 2022-01-20 12:28:26 +02:00
CTCaer
0e35e68fd5 bdk: se: add t210b01 data coherency WAR 2022-01-20 12:27:25 +02:00
CTCaer
853f10f774 bdk: pmc: update tzram defines 2022-01-20 12:13:35 +02:00
CTCaer
4628ee6dc5 bdk: di: window fb changes
- Get fb address from in window regs
- Remove 2 frames wait
2022-01-20 12:12:19 +02:00
CTCaer
3bb46c6470 bdk: di: allocate fifo buffer once 2022-01-20 12:09:29 +02:00
CTCaer
5e6a7c486b bdk: btn: enable HOME button as input 2022-01-16 01:05:42 +02:00
CTCaer
1a9c6bf983 bdk: correct reg init as per TRM 2022-01-16 01:04:52 +02:00
CTCaer
70504c295e bdk: various functionality independent changes 2022-01-16 01:03:24 +02:00
CTCaer
a5cd962f99 bdk: add global header 2022-01-15 23:58:27 +02:00
CTCaer
4d91d2baff bdk: fan: clamp duty before checking if the same 2021-10-26 10:53:22 +03:00
CTCaer
981c986b3f bdk: sdram: name the new micron modules 2021-10-19 09:13:14 +03:00
CTCaer
09b3e47ac8 bdk: touch: rename samsung touch panel 2021-10-19 09:11:58 +03:00
CTCaer
31d6c7d85d bdk: reg 5v: fix a hang with T210B01 and Hoag/Aula
- Hoag and Aula do not have a USB based 5V bus source, so do not touch CC4 pin.

- More importantly, in T210B01 the GPIO AO IO rail seems to be working properly from boot.
Plus it also seems that is needed by various components.

That was found when running on Aula. It was causing an immediate hang. Probably SoC wide.

Only allow control of it on T210 to avoid such issues.
2021-10-15 16:26:11 +03:00
CTCaer
9a17ca2628 bdk: disable fan control on Hoag and Aula
TODO: Add support for them.
These use a different way to init/control fan.
2021-10-15 16:19:16 +03:00
CTCaer
49bcaf3914 bdk: correct some types and warnings 2021-10-15 16:18:06 +03:00
CTCaer
82d0346615 bdk: fatfs: remove errors that depend on full diskio 2021-10-15 16:17:08 +03:00
CTCaer
808da1bce0 bdk: di: adjust OLED panel brightness curve
The Samsung AMOLED panel least legible backlight is at a high duty (45 / 255).
Change the linear curve to a more appropriate one.
2021-10-15 16:16:24 +03:00
CTCaer
6992ece762 bdk: touch: add samsung touch model name 2021-10-15 16:09:25 +03:00
CTCaer
681182540e bdk: di: add model name for the samsung panel 2021-10-15 16:07:18 +03:00
CTCaer
c801ef8dda bdk: use size defines where applicable 2021-10-01 15:03:18 +03:00
CTCaer
7e4c71748f bdk: types: refactor and add size defines 2021-10-01 14:33:55 +03:00
CTCaer
a1910156d8 bdk: hwinit: save boot reason for later usage 2021-10-01 14:32:42 +03:00
CTCaer
99d15eaac8 bdk: fatfs: check if string is null for puts/printf
Avoid writing garbage to a file by checking string pointer passed to f_puts and f_printf.

Important on many embedded platforms that do not abort on NULL dereference.
2021-10-01 14:27:57 +03:00
CTCaer
7fb10b0242 sdram: fix building for embedded lp0 config 2021-09-17 23:17:56 +03:00
CTCaer
bcec028b0f clock: update device frequency getter function
- Add missing write commits
- Remove hardcoded values
2021-09-17 23:16:43 +03:00
CTCaer
8f9d52aa89 clock: move pllx enable to clock object 2021-09-17 23:13:53 +03:00
CTCaer
d368b93fdd sdmmc: move error prints checks inside ifdefs 2021-09-17 23:12:54 +03:00
CTCaer
d5322f384b tsec: make sure cpu power rails are off 2021-09-17 23:10:57 +03:00
CTCaer
03d027615c sdram: update config for t210b01 (unused) 2021-09-17 23:09:33 +03:00
CTCaer
e9edcfeeb0 bdk: remove all references and defines to sept 2021-08-28 17:10:21 +03:00
CTCaer
4b7e1f699d ums/xusb: do not allow multiple CBW requests
On XUSB do not allow multiple requests for CBW to be done.
This avoids an issue with some XHCI controllers and OS combos (e.g. ASMedia and Linux/Mac OS) which confuse that and concatenate an old CBW request with another write request (SCSI Write) and create a babble error (transmit overflow).
2021-08-28 17:09:38 +03:00
CTCaer
134f3dac52 ums: add warn reporting to log status
Some OSes do not adhere to limits reported by UMS gadget to them.
In such cases, make sure that user is notified about their host skipping the checks and sending "illegal" commands.
2021-08-28 17:08:15 +03:00
CTCaer
1afb1a50c3 xusb: update driver
- Better port init/status
- Correct port status report
- Add babble detection and rescue
- Some refactoring
2021-08-28 17:03:49 +03:00
CTCaer
4914ce1d49 usb: add more timeout control for ep1 read/write finish 2021-08-28 17:00:23 +03:00
CTCaer
70a06a6cae sdram: add support for missing new dram ids
In preparation of dram chip shortages, add missing new ids that are now confirmed that they will be in mass usage
2021-08-28 16:56:49 +03:00
CTCaer
5044f014bf mc: move ahb aperture size control inside enable function 2021-08-28 16:51:16 +03:00
CTCaer
7c72c9777a fuse/hwinit: move automatic SBK set into fuse 2021-08-28 16:46:15 +03:00
CTCaer
73df5e6743 fuse: add nx aula hw type 2021-08-28 16:44:16 +03:00
CTCaer
9cf0b0f484 tsec: change kb to type
Now the path taken is decided by tsec fw type instead of mkey version
2021-08-28 16:42:03 +03:00
CTCaer
9541d1bbd3 se: add encrypt/decrypt defines 2021-08-28 16:40:29 +03:00
CTCaer
3e15eb44ab touch: rename 4th panel so it's not confused with errors 2021-08-28 16:39:38 +03:00
CTCaer
bf89d9b841 display: Add Aula panel support 2021-08-28 16:38:42 +03:00
CTCaer
dcdf687a07 sdmmc: add support for sandisk emmc device report 2021-07-06 10:15:59 +03:00
CTCaer
539caf3d83 utils: add bit count and bit count mask 2021-06-08 05:53:58 +03:00
CTCaer
ce6926c36c fuse: remove fuse counting, bit count will be used instead 2021-06-08 05:53:31 +03:00
CTCaer
9a21ff6976 regulator 5v: don't enable usb one by default 2021-06-08 05:51:21 +03:00
CTCaer
1f4f41b6e6 als: Update ambient light sensor driver to use integers
Additionally separate calibration so later Aula one can be used
2021-06-08 05:49:16 +03:00
CTCaer
7181683d8e ums: various fixes
- Immediately exit if offset exceeds num of sectors.
- Correct cmnd type and checks.
- Inform user if ejected unsafely (while medium removal prevention is enabled).
2021-05-11 10:45:17 +03:00
CTCaer
7d7134dd9e utils: correct align down 2021-05-11 10:34:10 +03:00
CTCaer
c29db97f73 hwinit/joycon: move uart clock deinits to joycon driver 2021-05-11 10:24:48 +03:00
CTCaer
cb633a8f32 display: add info about new InnoLux panel revision 2021-05-11 10:04:24 +03:00
CTCaer
6a4ab55930 storage: add sd_get_card_mounted declaration 2021-05-11 09:22:39 +03:00
CTCaer
d7ce2a81db bpmp: return previous fid when setting a new one 2021-05-11 09:21:12 +03:00
CTCaer
fd05f83636 ianos: add extensions magic
Useful to avoid using extensions if bootloader does not support them.
2021-04-11 10:30:24 +03:00
CTCaer
94e119fb51 max77620: allow max sdram voltage of 1.25V 2021-04-11 10:20:54 +03:00
CTCaer
c2ff4bf623 ianos: add regulator voltage set 2021-04-11 10:18:47 +03:00
CTCaer
28008ac7ac hwinit: add seamless display (L4T Linux/Android)
Initial support is for coreboot based preloading.
2021-04-11 09:18:55 +03:00
CTCaer
345d36287e display: add pwm duty getter 2021-04-11 09:16:55 +03:00
CTCaer
d42a94f148 minerva: Scale down RAM OC if stock boot 2021-04-09 19:28:04 +03:00
CTCaer
4958bd6a52 fatfs: utilize fatfs buffers for parsing gpt 2021-03-17 09:23:51 +02:00
CTCaer
46038032a4 bdk: make sure that boot storage has the correct size 2021-03-17 09:23:13 +02:00
CTCaer
f21f13b15d ums/nyx: reinit sd to update cal trimmers for max perf 2021-03-17 09:12:30 +02:00
CTCaer
0e12d8545b Decrease stack usage on various functions 2021-03-17 09:08:34 +02:00
CTCaer
9dbf745649 regulator 5V: fix battery/usb source swap 2021-03-17 08:56:46 +02:00
CTCaer
e8f73a42b8 fan: increase irq polling to get more accurate rpm 2021-03-17 08:55:54 +02:00
CTCaer
dbe431095a touch: report gpio info in case of unknown panel 2021-03-17 08:53:23 +02:00
CTCaer
513f77a2ad uart: use proper interrupt decoding 2021-03-17 08:51:49 +02:00
CTCaer
7a27a7b3b5 joycon: Disable regulators before sending the sleep cmd 2021-02-08 03:49:04 +02:00
CTCaer
3b9ab66cf1 nyx: Add resized emuMMC creation 2021-02-06 17:19:37 +02:00
CTCaer
e5689cfe57 fatfs: Add raw emuMMC support for USER partition 2021-02-06 17:11:32 +02:00
CTCaer
a4a056128a sdmmc: Add support for SDSC cards 2021-02-06 04:18:30 +02:00
CTCaer
6e314933d9 Various small changes 2021-02-06 04:17:31 +02:00
CTCaer
a31bedda97 ramdisk: Sypport variable size 2021-02-06 04:15:19 +02:00
CTCaer
9e34c5995d bis: Pull latest lockpick driver and refactor it
- Refactor various variables and functions
- Flush whole cache when full
- Allow cache to be disabled
- Add support for raw emuMMC in nyx contenxt
- Use partition names for keys (to avoid issues with different ordering)
- Add deinit function that flushes the whole cache
- Change bis lookup address
- Halve cache size to 256MB in order to support 512MB ramdisk also.

Co-Authored-By: shchmue <7903403+shchmue@users.noreply.github.com>
2021-02-06 04:05:31 +02:00
CTCaer
497bbdf3cd fatfs: Add PrFile2Safe creation in format tool 2021-02-06 03:59:20 +02:00
CTCaer
eea5463a5c nyx: Refactor nyx extra cfg 2021-02-06 03:55:01 +02:00
CTCaer
a8a45b215a nyx: Add emmc info about write cache and enhanced area 2021-02-06 03:44:27 +02:00
CTCaer
38f456a2ee sdmmc: Refactor again
- Refactor various variables and defines
- Removed Card/BGA and OEM ID info as they are static and useless
- Commented out bkops functions completely as not used
- Remove extra buf usage when there's already storage for storing that data
- Optimize various functions to save space
- Clean up useless or duplicate code
2021-02-06 03:41:35 +02:00
CTCaer
2428736bfa hos: Use structs for eks keyblobs and tsec keys 2021-02-06 03:00:48 +02:00
CTCaer
a7bf8bf118 se: Refactor with proper names
Additionally fix some bugs in rsa access control
2021-02-06 02:55:58 +02:00
CTCaer
8038e1faa9 fatfs: Restore win buffer order and explicitly DMA align it 2021-02-05 23:32:07 +02:00
CTCaer
15a7e49dde fatfs: Add simple GPT support
This allows for a simple GPT parsing and checking first partition to see if it's FAT based.

This allows hekate booting GPT with tiny size cost.
2021-02-05 23:27:52 +02:00
CTCaer
8fc5267110 tmp451: Show correct temperature for T210B01
The thermal measurement substrate transistor was changed in Mariko SoCs.
This ensures that it's properly offset by -12.5 °C.
2021-01-14 17:58:23 +02:00
CTCaer
f6a3b2c9ac sdmmc: Ensure writes gone through after disabling io power 2021-01-14 17:53:22 +02:00
CTCaer
2370ca0a44 util: Clear alarm wake flags also on power off even if rtc alram is off 2021-01-11 23:24:29 +02:00
CTCaer
c6c396ce2a reg5V: Manage battery source based on charger status 2021-01-11 21:30:59 +02:00
CTCaer
9daa14abec ums: Dim backlight and change the maintenance order 2021-01-04 20:12:26 +02:00
CTCaer
1f37b96359 coreboot mitigation: Reinstate SD controller power 2021-01-04 19:03:50 +02:00
CTCaer
0959dc3a2d nyx: Add touch panel info
This can probably also show if the panel is paired to the firmware.
In case it's not, an error will show up.
2021-01-04 02:49:07 +02:00
CTCaer
f4696da0ef sdram: Update names for Aula 2021-01-04 02:45:32 +02:00
CTCaer
83ab79c51e fuse: Return the proper dram id when raw is requested 2021-01-04 02:41:55 +02:00
CTCaer
745ac609d2 max7762x: Update everything to use the improved pmic management 2021-01-04 02:41:15 +02:00
CTCaer
0f9aa51afe max7762x: Refactor pmic
- Add Erista CPU/GPU pmics and Mariko CPU/GPU/DRAM pmics together with system pmic.
- Every type of pmic can be configured via the relevant functions.
- Better and easier configation of the regulators
2021-01-04 02:34:58 +02:00
CTCaer
9fbb28e887 max7762x: Update registers for all pmic types 2021-01-04 02:29:36 +02:00
CTCaer
adf2045896 joycon: Do not send CRC if nxpad + some refactoring 2021-01-03 15:37:44 +02:00
CTCaer
1a797bf93a
Merge pull request #545 from krnlyng/hori_support
joycon: add support for the hori split pad pro
2021-01-03 14:59:02 +02:00
Franz-Josef Haider
e491a4cf57 joycon: add support for the hori split pad pro 2020-12-31 13:54:00 +02:00
CTCaer
b7789f1edb xusb: Increase performance up to 96%
The default interrupt moderation on XUSB controller was causing 4.62ms latency, hurting performance tremendously, especially in smaller usb packets (which are the norm).
This change brings it to parity with USB2 controller.
2020-12-30 13:40:16 +02:00
CTCaer
4949331f4c usb: Rework timeouts
- Rework all timeouts to be more relaxed when doing big data transfers.
- Fix a bug where async transfer would timeout sooner instead of infinite tries.

Both showed up in Arch Linux, because of it's huge latency USB stack latency that can reach 1-2s.

The rework will let every OS work without adding additional wait time in the gadget loops.
2020-12-30 13:37:36 +02:00