Compare commits

...

47 Commits

Author SHA1 Message Date
5ee5debc3a dts: disable sound_codec for lpi3a to avoid panic 2025-11-21 15:14:42 +08:00
c8cba7c81b dts: spacemit: rename x1_orangepi-rv2.dts 2025-11-21 15:14:42 +08:00
James Deng
60e6765ae2 Merge remote-tracking branch 'internal/k1-release' into k1-bl-v2.2.y 2025-08-20 22:50:17 +08:00
zhangmeng
d5b2ef2c6a Merge remote-tracking branch 'origin/k1-dev' into k1-release
Change-Id: Iaf7b67f05faebea330a4b9f4593b1108b4f3e20f
2025-08-13 14:31:16 +08:00
zhangmeng
5bbd423d73 riscv: add ime extension in /proc/cpuinfo for userspace program
Change-Id: Ibfad53dce5b813eeca59801e60825d168aa23a2e
2025-08-13 14:25:07 +08:00
liweizhi
662a0c32be scripts: update build_kernel.sh to support build in docker
Usage: Run on the top of linux directory
	./scripts/build_kernel.sh [-c] [-d] [-x]

Change-Id: If33a505cae9cdbc8560aeaee62cad5a0524a0d54
2025-08-12 10:52:43 +08:00
yanhaodong
4e9d7cbeda k1: input: remove PEN event for libinput
Change-Id: I8984943d9ba2ebd5b45e5b81e09a603b548c4e6b
Signed-off-by: yanhaodong <haodong.yan@spacemit.com>
2025-08-11 13:52:15 +08:00
wanlong
180f0ef2c7 wireless: rtl8852bs: fix missing mutex_unlock in mac_ax
Change-Id: I4fe38a703141adcf67371f5164e8af073fcf5947
2025-08-06 15:35:52 +08:00
weijinmei
fedb75697d k1:audio: add playback_only support
avoid NULL pointer issue on some playback_only board

Change-Id: I90b75fa27087f3d9f3dfbf490c4008364ca84353
2025-08-01 09:40:10 +08:00
weijinmei
e8c154f25e k1:dts: add sound card playback_only config
Change-Id: I7806953a1fe879793b37a4a9cc4b4057f66e5825
2025-07-31 20:34:22 +08:00
James Deng
08e05c1286 Merge remote-tracking branch 'internal/k1-release' into k1-bl-v2.2.y 2025-07-28 10:30:49 +08:00
Nell
91e3d9a44b k1:p1:delete the shutdown-charging releated code
the charging logic in uboot don't use the shutdown-charging bit,
so we delete the code in kernle

Change-Id: Ie6be0968f929f528c2752eef0843ef25a6dca2b8
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-25 10:56:25 +08:00
liyeshan
959078162c k1_defconfig: Enable AMDGPU
Signed-off-by: liyeshan <yeshan.li@spacemit.com>
Change-Id: Ic893d7f650496b46e60c32e8d5c2ff0854cd6aac
2025-07-24 14:18:15 +08:00
liyeshan
3721fc6489 amdgpu,radeon: Add workarounds for the Spacemit K1-X RISC-V platform
1. In various GMC versions (v6-v11), the DMA address mask is
  reduced to 34 bits. This is necessary because PCIe devices on the
  Spacemit K1-X platform support a maximum of 34-bit physical addressing.
2. In amdgpu_ttm.c, force the use of the `ttm_write_combined` cache mode.
 This is required because the K1-X platform lacks PCIe cache coherency.
3. In radeon_ttm.c and amdgpu_vram_mgr.c, switch the caching for
IO memory to `ttm_uncached`.This is done to guarantee data correctness
 during VRAM access on this platform.

Signed-off-by: liyeshan <yeshan.li@spacemit.com>
Change-Id: I294b741d1cc7923bfe535299c304f9f443673d92
2025-07-24 14:17:52 +08:00
liyeshan
786e008e00 pcie: Adapt PCIe address space for AMD GPU on K1-X
1. In the Device Tree, merge the PCIe I/O and memory address
windows.The AMD GPU requires a large, contiguous BAR space,
which the previous separate windows could not satisfy.
2. Add a hack to correct the BAR space size calculation. The K1-X platform
reserves a total of 384MB (0x18000000) for PCIe devices (including BAR
and config space). However, the Linux kernel's allocation logic,
influenced by 128MB alignment, attempts to request a full 384MB BAR space
for the GPU.This commit reduces the requested size to 0x16000000,
ensuring the allocation succeeds, as the GPU itself only requires 258MB.

Signed-off-by: liyeshan <yeshan.li@spacemit.com>
Change-Id: Ic5610b455aac5b0dc97ac4904037865f83ad1c2c
2025-07-24 11:04:44 +08:00
zhangmeng
db0d3fc566 k1: support user-space load and store misaligned on io memory area
The PCIe BAR area must be mapped as IO attribute for GPU VRAM area,
but, there may be some misaligned access in user-space program. Then,
it will trigger 5# exception when misaligned load and 7# excepiton
when misaligned store. And user-space program will crash because of
the 5# exception and 7# exception can't be fixed.
So, we try to process the user-space io area misligned access firstly
when the 5# exception and 7# exception are caught

Change-Id: Iac78bcdb8505dd113dcc4deed782e78016ddbf9b
2025-07-23 09:25:05 +08:00
zhangmeng
27f0d82a2f Merge remote-tracking branch 'origin/k1-dev' into k1-release
Change-Id: Id57b1298ae73d10fdc3344e88fe14adf00765a5f
2025-07-17 16:07:52 +08:00
weijinmei
14d1b98300 i2s: adjust the sysclk divider parameters
The old parameters may cause jitter in sysclk.

Change-Id: Ia64dda7e35ae56090a7d27ad8ab972d3f8ba8280
Signed-off-by: weijinmei <jinmei.wei@spacemit.com>
2025-07-17 16:02:46 +08:00
wanlong
71908afd85 mmc: sdhci-of-k1x: fix the bug of schedule on spacemit_sdhci_request()
INFO: task kworker/3:1:81 blocked for more than 120 seconds.
      Not tainted 6.6.63 #20250714113129
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:kworker/3:1     state:D stack:0     pid:81    ppid:2      flags:0x00000000
Workqueue: events_freezable mmc_rescan
Call Trace:
[<ffffffff8101004e>] __schedule+0x32c/0xa86
[<ffffffff810107f6>] schedule+0x4e/0xd8
[<ffffffff80be23d6>] spacemit_sdhci_request+0xbc/0xfc
[<ffffffff80bc6c16>] __mmc_start_request+0x56/0x16e
[<ffffffff80bc6da6>] mmc_start_request+0x78/0x92
[<ffffffff80bc6eea>] mmc_wait_for_req+0x60/0xd0
[<ffffffff80bc6fb8>] mmc_wait_for_cmd+0x5e/0x88
[<ffffffff80bd2cd8>] mmc_io_rw_direct+0x7c/0x104
[<ffffffff80bd4288>] sdio_readb+0x2c/0x62
[<ffffffff02472052>] rtw_sdio_raw_read+0x19e/0x2c2 [8852bs]
[<ffffffff0250ef1a>] sdio_io+0xe4/0x2e4 [8852bs]
[<ffffffff0250f148>] rtw_sdio_read_cmd52+0x14/0x1c [8852bs]
[<ffffffff02596690>] hal_mac_sdio_cmd52_r8+0x2e/0x84 [8852bs]
[<ffffffff02644980>] w_indir_cmd53_sdio_8852b+0xc6/0x136 [8852bs]
[<ffffffff026391ce>] w8_indir_sdio+0x48/0x6c [8852bs]
[<ffffffff02639578>] reg_write8_sdio+0x54/0x72 [8852bs]
[<ffffffff0261e764>] mac_pwr_switch+0x358/0x418 [8852bs]
[<ffffffff02616f9a>] mac_hal_fast_init+0x4a/0x3a6 [8852bs]
[<ffffffff0259a870>] rtw_hal_mac_hal_fast_init+0xe4/0x2b8 [8852bs]
[<ffffffff0265b448>] hal_fast_start_8852b+0x10/0x18 [8852bs]
[<ffffffff0265ccbe>] hal_fast_start_8852bs+0x4e/0xae [8852bs]
[<ffffffff025b372e>] rtw_hal_preload+0x3c/0xca [8852bs]
[<ffffffff0251f06e>] rtw_phl_preload+0x20/0x3e [8852bs]
[<ffffffff02504388>] rtw_hw_init+0x128/0x294 [8852bs]
[<ffffffff02471bce>] rtw_dev_probe+0xd8/0x3be [8852bs]
[<ffffffff80bd3746>] sdio_bus_probe+0xf4/0x110
[<ffffffff8085d10c>] really_probe+0x8c/0x326
[<ffffffff8085d408>] __driver_probe_device+0x62/0x110
[<ffffffff8085d4ec>] driver_probe_device+0x36/0xba
[<ffffffff8085d5e2>] __device_attach_driver+0x72/0xd0
[<ffffffff8085b35e>] bus_for_each_drv+0x5c/0xb2
[<ffffffff8085d9aa>] __device_attach+0x84/0x158
[<ffffffff8085dc22>] device_initial_probe+0xe/0x16
[<ffffffff8085c156>] bus_probe_device+0x86/0x88
[<ffffffff80859a44>] device_add+0x534/0x6ec
[<ffffffff80bd38c2>] sdio_add_func+0x60/0x7a
[<ffffffff80bd29a2>] mmc_attach_sdio+0x178/0x34a
[<ffffffff80bc85c6>] mmc_rescan+0x274/0x334
[<ffffffff80037556>] process_one_work+0x116/0x314
[<ffffffff80037a12>] worker_thread+0x2be/0x3ac
[<ffffffff8003ea76>] kthread+0xda/0xf6
[<ffffffff81017266>] ret_from_fork+0xe/0x18

Change-Id: Id8fa5f7322455e1feeafafd083c615cbdcd49731
2025-07-17 14:57:25 +08:00
xuhaodong
14053d2d46 k1: ZT_RVOH007: enbale camera sensor
Change-Id: I1f4d44633ca5df18c31d5d7fb4cc4d0708e7c7f3
2025-07-17 14:43:49 +08:00
xuhaodong
746ca83504 camera: sensor: fix multiple sensors cannot get power simultaneously
Change-Id: I63888dae42983961609e0102d7fc240ba2176269
2025-07-17 14:43:35 +08:00
huzhen
fdee3b35a0 PCI: k1x: Add hold_phy_rst before phy enable
During the probe and resume processes, phy_enable will clear the app_hold_phy_rst bit.
app_hold_phy_rst must be set before this bit is cleared.

Change-Id: Ia9332c041199095dbfb9c0059b4704db743f189a
2025-07-17 14:42:51 +08:00
Junzhong Pan
120edd4c60 pinctrl: k1x: set strict for pinmux_ops
This will not allow simultaneous use of the same pin for GPIO and
another function. If user use a pin in such way, an error would be
reported, make it easier to debug.

d401e000.pinctrl: pin PIN80 already requested by k1x-gpio:79; cannot claim for xxx

Signed-off-by: Junzhong Pan <junzhong.pan@spacemit.com>
Change-Id: I0aad1e6a55ac46c47537d18bdb8586779f290435
2025-07-17 14:41:58 +08:00
wanlong
e3914cc9e6 usb: typec: husb239: add delay work for pd contract update
Change-Id: I2287a56cd8a31451c8f207bf5fdae3932b17b5b8
2025-07-11 15:14:17 +08:00
huanghaiqiang
89b76ac21d add RV4B solution
Change-Id: I011de8ba866873b0343fa71af0c2f641f56f111a
2025-07-11 15:13:00 +08:00
wanlong
2ace592a74 wireless: rtl8852bs: fix the warning about rg_interface lock not initialized
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 2165 Comm: wpa_supplicant Not tainted 6.6.36+ #82
Hardware name: spacemit k1-x FusionOne board (DT)
Call Trace:
[<ffffffff8000693c>] dump_backtrace+0x1c/0x24
[<ffffffff80fae9f2>] show_stack+0x2c/0x38
[<ffffffff80fc4a36>] dump_stack_lvl+0x3c/0x54
[<ffffffff80fc4a62>] dump_stack+0x14/0x1c
[<ffffffff8007e6da>] register_lock_class+0x42e/0x47e
[<ffffffff8007d326>] __lock_acquire.isra.0+0x48/0x694
[<ffffffff8007da5e>] lock_acquire+0xec/0x1c2
[<ffffffff80fd02f8>] _raw_spin_lock_bh+0x38/0x76
[<ffffffff029305c4>] rtw_phl_query_regulation_info+0x26/0x56 [8852bs]
[<ffffffff029b0c76>] rtw_hal_query_regulation+0x10/0x18 [8852bs]
[<ffffffff02a301c6>] _send_bt_country_code+0xc2/0x108 [8852bs]
[<ffffffff02a3152e>] _update_bt_scbd+0xbc/0x404 [8852bs]
[<ffffffff02a331a8>] _ntfy_wl_rfk+0x10a/0x264 [8852bs]
[<ffffffff02994ae6>] rtw_hal_btc_wl_rfk_ntfy+0x24/0x32 [8852bs]
[<ffffffff02aba2b6>] halrf_btc_rfk_ntfy+0xf8/0x15e [8852bs]
[<ffffffff02ab6bde>] halrf_dack_trigger+0x2c/0x18c [8852bs]
[<ffffffff02acb3a0>] halrf_dm_init+0x90/0x156 [8852bs]
[<ffffffff02992b9a>] rtw_hal_rf_dm_init+0x14/0x1c [8852bs]
[<ffffffff02a47632>] hal_start_8852b+0x17c/0x2d0 [8852bs]
[<ffffffff02a48fa8>] hal_start_8852bs+0x4c/0x6e [8852bs]
[<ffffffff029995c0>] rtw_hal_start+0x24/0x210 [8852bs]
[<ffffffff028fd660>] rtw_phl_start+0xc0/0x128 [8852bs]
[<ffffffff028e2754>] rtw_hw_start+0x28/0x50 [8852bs]
[<ffffffff0282e176>] netdev_open+0xce/0x33c [8852bs]
[<ffffffff80cb6674>] __dev_open+0xcc/0x174
[<ffffffff80cb6a90>] __dev_change_flags+0x15c/0x1cc
[<ffffffff80cb6b1e>] dev_change_flags+0x1e/0x56
[<ffffffff80d8fdd4>] devinet_ioctl+0x1ec/0x5fc
[<ffffffff80d91812>] inet_ioctl+0x11c/0x152
[<ffffffff80c8a18c>] sock_do_ioctl+0x32/0xb4
[<ffffffff80c8afd0>] sock_ioctl+0xf2/0x2e8
[<ffffffff8026a6d8>] __riscv_sys_ioctl+0x86/0xae
[<ffffffff80fc54e0>] do_trap_ecall_u+0xba/0x12e
[<ffffffff80fd13f6>] ret_from_exception+0x0/0x6e

Change-Id: I8315279ed046109a171b73376c60bb622c0f4ca3
2025-07-11 13:54:20 +08:00
James Deng
6822bafeae Merge remote-tracking branch 'origin/k1-dev' into k1-release
Change-Id: I07561e8e8d46bc49285f49c14044697febdfaf33
2025-07-04 09:58:09 +08:00
liweizhi
67132bd6ae scripts/package/mkdebian
linux-image-6.6.63 depends on bianbu-esos (= 0.0.10)

Change-Id: I795f474e1c23de13c1a77320c588e58dc20b9cc8
2025-07-04 00:47:04 +08:00
zhangmeng
8dc9f24551 Merge remote-tracking branch 'origin/k1-dev' into k1-release
Change-Id: I9cb47755d031341ba9d219190baa15e25bf80fd9
2025-07-03 20:28:36 +08:00
Nell
503f4cb8b8 k1: update rootfs.cpio.gz
update the esos.elf to support DDR size 512M
sync with commit-id(master):f711f0809ac4657e9c12797c10e822a8416f07c2

Change-Id: Ic8f704017cfb0e051b7ccc7e608029e9e679e3ac
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-03 19:50:22 +08:00
goumin
294f479f26 Add nand boot support.
Change-Id: I8ed2a85dee3bfb50830f4550f29397aadb95ee5f
2025-07-03 16:08:05 +08:00
Nell
7b7932f6dd k1: set the load entry of kernel image to 0x600000
Change-Id: I078f1e5865373cc5cef6ccc7028960106499bbb8
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-03 15:17:05 +08:00
Nell
58fddb55e4 k1:dtsi:remoteproc: change the RCPU running address to 1M
Change-Id: Ib87953dc6ec2c17a7ffab37bc9d3e3f12091d43e
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-03 15:16:54 +08:00
Nell
0dc7617ee2 k1:remoteproc: modify the code to support moving the runtime-env of rcpu
to lower DDR address space

Change-Id: I8a0ff4f29e9695bdf9b90a3385984ab0fcd65ba8
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-03 15:16:37 +08:00
Nell
dd4630946d k1:remoteproc: modify the core code to support VIRTIO_F_ACCESS_PLATFORM
feature

when enable this feature, the AP & rcpu will using dma_addr to share
memroy

Change-Id: I0c2427abf3c455fcbdc78a51788287f8198eae55
Signed-off-by: Nell <xianbin.zhu@spacemit.com>
2025-07-03 15:16:27 +08:00
Junzhong Pan
b14d273869 dtsi: k1-x: use RESET_COMBO_PHY for combphy
Change-Id: Ifd12910bbff95c7df4ce8824b9ec59bde9e45497
Signed-off-by: Junzhong Pan <junzhong.pan@spacemit.com>
2025-07-03 10:29:16 +08:00
Junzhong Pan
defacd6ae1 reset: spacemit-k1x: add RESET_COMBO_PHY reset signal
USB3 and PCIE0 of k1x shares a combo phy. BIT(8) of APMU register
APMU_PCIE_CLK_RES_CTRL_0 is designed for USB3 to reset the combo phy
without resetting the PCIE0.

Change-Id: I1935d228b1c4c8d81fd280a8dc245806539d7104
Signed-off-by: Junzhong Pan <junzhong.pan@spacemit.com>
2025-07-03 10:28:53 +08:00
zhenglilang
8be331c040 k1:display: enable lcd hxdm101 for ZT_RVOH007
Change-Id: I7e1923c38e93062f7684c33688cebd42f5b9bc0e
2025-07-03 10:26:55 +08:00
yanhaodong
ad75b543a7 ZT_RVOH007:k1/dts: add k1-x_ZT_RVOH007.dts
Change-Id: If022c3a99761442dfc947962631e658df9c22c2e
Signed-off-by: yanhaodong <haodong.yan@spacemit.com>
2025-07-03 10:25:45 +08:00
zhenglilang
4f44e051e2 k1:display: ignore HPD IRQ if HDMI suspended
Change-Id: I1b73861871b1b641378c942c2a385a35151b68cc
2025-07-02 19:55:04 +08:00
zengyu
82d6e838de k1: ethercat: fix incorrect error path in emac_probe
Change-Id: I33da6d78004f62e8607050fe19d5f6c461afc84a
2025-07-01 10:27:38 +08:00
zengyu
125f711256 k1: ethercat: native driver optimization
Reused SKBs in the RX path to avoid frequent allocation and free.
In a 24-hour test running the same demo, max execution time jitter was
reduced by 18.1%, lowering the risk of synchronization failure.

Change-Id: I23bc1c0c56677dd233548cc183e8e5f1497ddefa
2025-07-01 10:27:13 +08:00
zhenglilang
aa9769f6b2 k1:display: add lcd hxdm101
Change-Id: I94ca7b9d75bb6ddeadead4a028c1f1e3286563ac
2025-07-01 10:25:57 +08:00
wanlong
bf34673bce wireless: rtl8852bs: fix oops in rtw_phl_cmd_scan_request() during
suspend

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000169
Oops [#1]
Modules linked in: algif_hash
 algif_skcipher af_alg 8852bs binfmt_misc sch_fq_codel ip_tables autofs4
CPU: 5 PID: 1001 Comm: fsm_thread Tainted: G        W          6.6.63 #20250623142956
Hardware name: spacemit k1-x deb1 board (DT)
epc : rtw_phl_cmd_scan_request+0x24/0x98c [8852bs]
 ra : rtw_sitesurvey_cmd+0x3e8/0x67a [8852bs]
epc : ffffffff0237dc42 ra : ffffffff022fa748 sp : ffffffc80939ba00
 gp : ffffffff820fac50 tp : ffffffd905ff8c80 t0 : ffffffc80939baa8
 t1 : 0000000000000001 t2 : 4f525245203a5754 s0 : ffffffc80939bae0
 s1 : ffffffc80926e18c a0 : ffffffc80063d000 a1 : ffffffd904328000
 a2 : 0000000000000010 a3 : 0000000000006312 a4 : 0000000000000000
 a5 : 0000000000000000 a6 : 0000000000000000 a7 : ffffffff8213c7b8
 s2 : ffffffc80926d048 s3 : ffffffd904328000 s4 : ffffffff026b8c08
 s5 : ffffffd907830000 s6 : 0000000000000000 s7 : 0000000000000070
 s8 : 0000000000000001 s9 : ffffffff026b7fd8 s10: ffffffd907837a78
 s11: ffffffd92c6dfe00 t3 : ffffffff82112ba7 t4 : ffffffff82112ba7
 t5 : ffffffff82112ba8 t6 : ffffffd9078300aa
status: 0000000200000120 badaddr: 0000000000000169 cause: 000000000000000d
[<ffffffff0237dc42>] rtw_phl_cmd_scan_request+0x24/0x98c [8852bs]
[<ffffffff022fa748>] rtw_sitesurvey_cmd+0x3e8/0x67a [8852bs]
[<ffffffff0227ba34>] rrm_sitesurvey.constprop.0.isra.0+0xd2/0x19e [8852bs]
[<ffffffff0227f760>] rrm_do_meas_st_hdl+0x10a/0x30c [8852bs]
[<ffffffff0227875c>] fsm_state_run.isra.0+0x66/0x128 [8852bs]
[<ffffffff022794ee>] fsm_state_goto+0x50/0x13c [8852bs]
[<ffffffff0227f482>] rrm_idle_st_hdl+0x2e2/0x356 [8852bs]
[<ffffffff0227875c>] fsm_state_run.isra.0+0x66/0x128 [8852bs]
[<ffffffff02278b9c>] fsm_thread_share+0x37e/0x478 [8852bs]
[<ffffffff8003ea76>] kthread+0xda/0xf6
[<ffffffff80fde1ce>] ret_from_fork+0xe/0x18
Code: f556 1180 b703 1c05 ba17 0033 0a13 fd2a 2783 000a (4703) 1697

Change-Id: I0ae3eca28216f31824767ff4ba6eacc637be1537
Signed-off-by: wanlong <long.wan@spacemit.com>
2025-07-01 10:21:44 +08:00
goumin
9cc34aec3f Led:Change led mode to heartbeat for k1-x_MUSE-Pi-Pro.
Change-Id: I10d3ba181ba41693a192690e0fa5889b099d9eb9
2025-07-01 10:20:44 +08:00
James Deng
cecd843d17 Merge remote-tracking branch 'internal/k1-bl-v2.2.y' into k1-bl-v2.2.y 2025-06-26 17:57:39 +08:00
50626b4a9d riscv: dts: spacemit: fix overlapping space for imggpu
The GPU device tree node is currently declared with a overlarged size
that overlaps with Ethernet.

Fix this by setting the size to the base address of Ethernet minus by
the base address of GPU.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
2025-06-16 11:04:28 +08:00
43 changed files with 3053 additions and 233 deletions

View File

@@ -176,6 +176,19 @@ config SPACEMIT_ERRATA_LOAD_ATOMIC
help
This enable fix errata caused by readforward and writeback.
config SPACEMIT_K1_PCIE_USR_MISALIGNED
bool "process user space misaligned access on PCIe Slave IO Area"
depends on SOC_SPACEMIT_K1X
default y
help
The PCIe controller in Spacemit K1 does not support discontinuous
write operations with AXI bus-generated wstrb signals. Consequently,
the PCIe slave memory space is mapped as IO attributes. However,
when user-space programs perform unaligned memory accesses in this
IO-attributed space, memory access faults occur. Specialized handling
for this specific error type is implemented to ensure proper execution
of user-space programs.
endif
endmenu # "SoC selection"

View File

@@ -5,8 +5,8 @@ dtb-$(CONFIG_SOC_SPACEMIT_K1X) += k1-x_fpga.dtb k1-x_fpga_1x4.dtb k1-x_fpga_2x2.
k1-x_MUSE-Pi.dtb k1-x_milkv-jupiter.dtb m1-x_milkv-jupiter.dtb \
k1-x_MUSE-Book.dtb k1-x_lpi3a.dtb k1-x_MUSE-Card.dtb \
k1-x_MUSE-Paper-mini-4g.dtb \
k1-x_baton-camera.dtb k1-x_FusionOne.dtb k1-x_InnoBoard-Pi.dtb \
k1-x_baton-camera.dtb k1-x_FusionOne.dtb x1_orangepi-rv2.dtb \
k1-x_ZT001H.dtb k1-x_uav.dtb k1-x_MUSE-Paper2.dtb \
k1-x_bit-brick.dtb k1-x_LX-V10.dtb k1-x_NetBridge-C1.dtb \
k1-x_MUSE-Pi-Pro.dtb k1-x_som.dtb
k1-x_MUSE-Pi-Pro.dtb k1-x_som.dtb k1-x_ZT_RVOH007.dtb k1-x_RV4B.dtb
obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))

View File

@@ -426,39 +426,45 @@
ranges;
/* rcpu's heap */
rcpu_mem_heap: rcpu_mem_heap@30000000 {
reg = <0x0 0x30000000 0x0 0x200000>;
rcpu_mem_heap: rcpu_mem_heap@100000 {
reg = <0x0 0x100000 0x0 0x200000>;
da_base = <0x30000000>;
no-map;
};
/* vring0 */
vdev0vring0: vdev0vring0@30200000 {
reg = <0x0 0x30200000 0x0 0x3000>;
vdev0vring0: vdev0vring0@300000 {
reg = <0x0 0x300000 0x0 0x3000>;
da_base = <0x30200000>;
no-map;
};
/* vring1 */
vdev0vring1: vdev0vring1@30203000 {
reg = <0x0 0x30203000 0x0 0x3000>;
vdev0vring1: vdev0vring1@303000 {
reg = <0x0 0x303000 0x0 0x3000>;
da_base = <0x30203000>;
no-map;
};
/* share memory buffer */
vdev0buffer: vdev0buffer@30206000 {
vdev0buffer: vdev0buffer@306000 {
compatible = "shared-dma-pool";
reg = <0x0 0x30206000 0x0 0xf6000>;
reg = <0x0 0x306000 0x0 0xf6000>;
da_base = <0x30206000>;
no-map;
};
/* the resource table */
rsc_table: rsc_table@302fc000 {
reg = <0x0 0x302fc000 0x0 0x4000>;
rsc_table: rsc_table@3fc000 {
reg = <0x0 0x3fc000 0x0 0x4000>;
da_base = <0x302fc000>;
no-map;
};
/* used for rcpu code & data & bss space */
rcpu_mem_0: rcpu_mem_0@30300000 {
reg = <0x0 0x30300000 0x0 0x200000>;
rcpu_mem_0: rcpu_mem_0@400000 {
reg = <0x0 0x400000 0x0 0x200000>;
da_base = <0x30300000>;
no-map;
};
};
@@ -559,6 +565,16 @@
status = "okay";
};
/* for rcpu vqueue buffer . */
dram_range8: dram_range@8 {
compatible = "spacemit-dram-bus";
#address-cells = <2>;
#size-cells = <2>;
dma-ranges = <0x0 0x30200000 0x0 0x300000 0x0 0xfc000>;
#interconnect-cells = <0>;
status = "okay";
};
clint0: clint@e4000000 {
compatible = "riscv,clint0";
interrupts-extended = <
@@ -1022,7 +1038,7 @@
compatible = "spacemit,k1-x-rproc";
reg = <0 0xc088c000 0 0x1000>,
<0 0xc0880000 0 0x200>;
ddr-remap-base = <0x30000000>;
ddr-remap-base = <0x100000>;
esos-entry-point = <0x30300114>;
clocks = <&ccu CLK_AUDIO>, <&ccu CLK_AUDIO_APB>;
clock-names = "core", "apb";
@@ -1033,6 +1049,8 @@
mbox-names = "vq0", "vq1";
firmware-name = "esos.elf";
power-domains = <&power K1X_PMU_AUD_PWR_DOMAIN>;
interconnects = <&dram_range8>;
interconnect-names = "dma-mem";
memory-region = <&rcpu_mem_0>, <&rcpu_mem_heap>, <&vdev0vring0>, <&vdev0vring1>, <&vdev0buffer>, <&rsc_table>;
status = "okay";
};
@@ -2116,7 +2134,7 @@
reg = <0x0 0xc0b10000 0x0 0x800>,
<0x0 0xd4282910 0x0 0x400>;
reg-names = "puphy", "phy_sel";
resets = <&reset RESET_PCIE0>;
resets = <&reset RESET_COMBO_PHY>;
reset-names = "phy_rst";
#phy-cells = <1>;
status = "disabled";
@@ -2354,8 +2372,7 @@
#address-cells = <3>;
#size-cells = <2>;
ranges = <0x01000000 0x0 0xb7002000 0 0xb7002000 0x0 0x100000>,
<0x42000000 0x0 0xa0000000 0 0xa0000000 0x0 0x10000000>,
<0x02000000 0x0 0xb0000000 0 0xb0000000 0x0 0x7000000>;
<0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x17000000>;
interconnects = <&dram_range7>;
interconnect-names = "dma-mem";
@@ -2713,6 +2730,7 @@
sound_hdmi: snd-card@0 {
compatible = "spacemit,simple-audio-card";
simple-audio-card,name = "snd-hdmi";
simple-audio-card,playback_only;
status = "disabled";
interconnects = <&dram_range4>;
interconnect-names = "dma-mem";

View File

@@ -169,7 +169,7 @@
led1 {
label = "sys-led";
gpios = <&gpio 96 0>;
linux,default-trigger = "none";
linux,default-trigger = "heartbeat";
default-state = "on";
status = "okay";
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1227,7 +1227,7 @@
};
&sound_codec {
status = "okay";
status = "disabled";
/*simple-audio-card,dai-link@0 {
reg = <0>;
format = "i2s";
@@ -1248,7 +1248,8 @@
sound-dai = <&es7210_audio_codec>;
};
};*/
//simple-audio-card,name = "snd-es8326";
simple-audio-card,name = "snd-es8156";
simple-audio-card,playback_only;
spacemit,mclk-fs = <64>;
simple-audio-card,codec {
sound-dai = <&es8156_audio_codec>;

View File

@@ -0,0 +1,155 @@
// SPDX-License-Identifier: GPL-2.0
/ { lcds: lcds {
lcd_hxdm101_mipi: lcd_hxdm101_mipi {
dsi-work-mode = <1>; /* video burst mode*/
dsi-lane-number = <4>;
dsi-color-format = "rgb888";
width-mm = <135>;
height-mm = <216>;
use-dcs-write;
/*mipi info*/
height = <1920>;
width = <1200>;
hfp = <80>;
hbp = <50>;
hsync = <10>;
vfp = <60>;
vbp = <25>;
vsync = <4>;
fps = <60>;
work-mode = <0>;
rgb-mode = <3>;
lane-number = <4>;
phy-bit-clock = <1000000000>;
phy-esc-clock = <76800000>;
split-enable = <0>;
eotp-enable = <0>;
burst-mode = <2>;
esd-check-enable = <0>;
/* DSI_CMD, DSI_MODE, timeout, len, cmd */
initial-command = [
39 01 00 02 B0 00
39 01 00 02 B2 50
39 01 00 02 B0 01
39 01 00 02 C0 00
39 01 00 02 C1 17
39 01 00 02 C2 01
39 01 00 02 C3 26
39 01 00 02 C4 00
39 01 00 02 C5 23
39 01 00 02 C6 11
39 01 00 02 C7 05
39 01 00 02 C8 07
39 01 00 02 C9 09
39 01 00 02 CA 0B
39 01 00 02 CB 1B
39 01 00 02 CC 1D
39 01 00 02 CD 1F
39 01 00 02 CE 21
39 01 00 02 CF 0F
39 01 00 02 D0 0D
39 01 00 02 D1 00
39 01 00 02 D2 00
39 01 00 02 D3 00
39 01 00 02 D4 00
39 01 00 02 D5 18
39 01 00 02 D6 02
39 01 00 02 D7 26
39 01 00 02 D8 00
39 01 00 02 D9 23
39 01 00 02 DA 11
39 01 00 02 DB 06
39 01 00 02 DC 08
39 01 00 02 DD 0A
39 01 00 02 DE 0C
39 01 00 02 DF 1C
39 01 00 02 E0 1E
39 01 00 02 E1 20
39 01 00 02 E2 22
39 01 00 02 E3 10
39 01 00 02 E4 0E
39 01 00 02 E5 00
39 01 00 02 E6 00
39 01 00 02 E7 00
39 01 00 02 B0 03
39 01 00 02 BE 04
39 01 00 02 B9 40
39 01 00 02 CC 88
39 01 00 02 C8 0C
39 01 00 02 C9 07
39 01 00 02 CD 01
39 01 00 02 CA 40
39 01 00 02 CE 1A
39 01 00 02 CF 60
39 01 00 02 D2 08
39 01 00 02 D3 08
39 01 00 02 DB 01
39 01 00 02 D9 06
39 01 00 02 D4 00
39 01 00 02 D5 01
39 01 00 02 D6 04
39 01 00 02 D7 03
39 01 00 02 C2 00
39 01 00 02 C3 0E
39 01 00 02 C4 00
39 01 00 02 C5 0E
39 01 00 02 DD 00
39 01 00 02 DE 0E
39 01 00 02 E6 00
39 01 00 02 E7 0E
39 01 00 02 C2 00
39 01 00 02 C3 0E
39 01 00 02 C4 00
39 01 00 02 C5 0E
39 01 00 02 DD 00
39 01 00 02 DE 0E
39 01 00 02 E6 00
39 01 00 02 E7 0E
39 01 00 02 B0 06
39 01 00 02 C0 A5
39 01 00 02 D5 1C
39 01 00 02 C0 00
39 01 00 02 B0 00
39 01 00 02 BD 17
39 01 00 02 BA 8F
39 01 00 02 F9 5C
39 01 00 02 C2 14
39 01 00 02 C4 14
39 01 00 02 BF 1A
39 01 00 02 C0 11
39 01 96 01 11
39 01 32 01 29
];
sleep-in-command = [
39 01 78 01 28
39 01 78 01 10
];
sleep-out-command = [
39 01 96 01 11
39 01 32 01 29
];
read-id-command = [
37 01 00 01 05
14 01 00 05 fb fc fd fe ff
];
display-timings {
timing0 {
clock-frequency = <153600000>;
hactive = <1200>;
hfront-porch = <80>;
hback-porch = <50>;
hsync-len = <10>;
vactive = <1920>;
vfront-porch = <60>;
vback-porch = <25>;
vsync-len = <4>;
vsync-active = <1>;
hsync-active = <1>;
};
};
};
};};

View File

@@ -14,7 +14,7 @@
#include "k1-x_thermal_cooling.dtsi"
/ {
model = "spacemit k1-x InnoBoard board";
model = "Xunlong OrangePi RV2";
modules_usrload = "8852bs";
cpus: cpus {

View File

@@ -50,6 +50,7 @@ CONFIG_SMP=y
CONFIG_NR_CPUS=8
CONFIG_RISCV_SBI_V01=y
# CONFIG_RISCV_BOOT_SPINWAIT is not set
CONFIG_IMAGE_LOAD_OFFSET=0x600000
CONFIG_SUSPEND_SKIP_SYNC=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_FREQ=y
@@ -896,6 +897,10 @@ CONFIG_SPACEMIT_K1X_VIR_CAMERA=y
# CONFIG_DVB_SP2 is not set
CONFIG_DRM_RADEON=m
CONFIG_DRM_RADEON_USERPTR=y
CONFIG_DRM_AMDGPU=m
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU_USERPTR=y
CONFIG_DRM_SPACEMIT=y
CONFIG_SPACEMIT_MIPI_PANEL=y
CONFIG_SPACEMIT_HDMI=y
@@ -1156,7 +1161,7 @@ CONFIG_JFFS2_COMPRESSION_OPTIONS=y
CONFIG_JFFS2_LZO=y
CONFIG_JFFS2_RUBIN=y
CONFIG_JFFS2_CMODE_NONE=y
CONFIG_UBIFS_FS=m
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_AUTHENTICATION=y
CONFIG_CRAMFS=m
CONFIG_CRAMFS_MTD=y
@@ -1309,8 +1314,6 @@ CONFIG_CRYPTO_SM3_GENERIC=m
CONFIG_CRYPTO_VMAC=m
CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_XCBC=m
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_842=m
CONFIG_CRYPTO_LZ4=m
CONFIG_CRYPTO_LZ4HC=m

View File

@@ -235,7 +235,11 @@ arch_initcall(riscv_cpuinfo_init);
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_SOC_SPACEMIT
static void print_isa(struct seq_file *f, unsigned long cpu_id)
#else
static void print_isa(struct seq_file *f)
#endif
{
seq_puts(f, "isa\t\t: ");
@@ -255,6 +259,10 @@ static void print_isa(struct seq_file *f)
seq_printf(f, "%s", riscv_isa_ext[i].name);
}
#ifdef CONFIG_SOC_SPACEMIT
if(cpumask_test_cpu(cpu_id, &ai_cpu_mask))
seq_printf(f, "_ime");
#endif
seq_puts(f, "\n");
}
@@ -313,7 +321,11 @@ static int c_show(struct seq_file *m, void *v)
if (!of_property_read_string(node, "model", &model))
seq_printf(m, "model name\t: %s\n", model);
#ifdef CONFIG_SOC_SPACEMIT
print_isa(m, cpu_id);
#else
print_isa(m);
#endif
print_mmu(m);
if (acpi_disabled) {

View File

@@ -44,8 +44,8 @@ SYM_CODE_START(_start)
.dword 0
#else
#if __riscv_xlen == 64
/* Image load offset(2MB) from start of RAM */
.dword 0x200000
/* Image load offset(2MB ?) from start of RAM */
.dword CONFIG_IMAGE_LOAD_OFFSET
#else
/* Image load offset(4MB) from start of RAM */
.dword 0x400000

View File

@@ -211,8 +211,63 @@ asmlinkage __visible __trap_section void do_trap_insn_illegal(struct pt_regs *re
}
}
#ifdef CONFIG_SPACEMIT_K1_PCIE_USR_MISALIGNED
#define SPACEMIT_K1_PCIE_DATA_LOW (0x80000000)
#define SPACEMIT_K1_PCIE_DATA_HIGH (0xB7FFFFFF)
static int check_if_user_io_area_misaligned(struct pt_regs *regs)
{
pte_t *ptep;
spinlock_t *ptl;
unsigned long v_addr = regs->badaddr, phy_addr;
struct mm_struct *mm = current->mm;
/* try to get the pte of the trap address */
ptep = get_locked_pte(mm, v_addr, &ptl);
if (!ptep)
return 0;
/* check if the area is _PAGE_IO attribute */
if (!pte_present(*ptep) || !(pte_val(*ptep) & _PAGE_IO)) {
pte_unmap_unlock(ptep, ptl);
return 0;
}
/* release the pte */
pte_unmap_unlock(ptep, ptl);
/* check if the area is in pcie memory area */
phy_addr = (pte_pfn(*ptep) << PAGE_SHIFT) | (v_addr & ~PAGE_MASK);
if ((phy_addr < SPACEMIT_K1_PCIE_DATA_LOW) || (phy_addr > SPACEMIT_K1_PCIE_DATA_HIGH)) {
return 0;
}
return 1;
}
DO_ERROR_INFO(do_trap_load_fault_inner,
SIGSEGV, SEGV_ACCERR, "load access fault");
asmlinkage __visible __trap_section void do_trap_load_fault(struct pt_regs *regs)
{
/* Try to process the exception as a load misaligned on io memory area */
if (user_mode(regs)) {
irqentry_enter_from_user_mode(regs);
if (check_if_user_io_area_misaligned(regs) && !handle_misaligned_load(regs)) {
irqentry_exit_to_user_mode(regs);
return;
}
irqentry_exit_to_user_mode(regs);
}
do_trap_load_fault_inner(regs);
}
#else
DO_ERROR_INFO(do_trap_load_fault,
SIGSEGV, SEGV_ACCERR, "load access fault");
#endif
asmlinkage __visible __trap_section void do_trap_load_misaligned(struct pt_regs *regs)
{
@@ -255,8 +310,31 @@ asmlinkage __visible __trap_section void do_trap_store_misaligned(struct pt_regs
irqentry_nmi_exit(regs, state);
}
}
#ifdef CONFIG_SPACEMIT_K1_PCIE_USR_MISALIGNED
DO_ERROR_INFO(do_trap_store_fault_inner,
SIGSEGV, SEGV_ACCERR, "store (or AMO) access fault");
asmlinkage __visible __trap_section void do_trap_store_fault(struct pt_regs *regs)
{
/* Try to process the exception as a store misaligned on io memory area */
if (user_mode(regs)) {
irqentry_enter_from_user_mode(regs);
if (check_if_user_io_area_misaligned(regs) && !handle_misaligned_store(regs)) {
irqentry_exit_to_user_mode(regs);
return;
}
irqentry_exit_to_user_mode(regs);
}
do_trap_store_fault_inner(regs);
}
#else
DO_ERROR_INFO(do_trap_store_fault,
SIGSEGV, SEGV_ACCERR, "store (or AMO) access fault");
#endif
DO_ERROR_INFO(do_trap_ecall_s,
SIGILL, ILL_ILLTRP, "environment call from S-mode");
DO_ERROR_INFO(do_trap_ecall_m,

View File

@@ -1103,6 +1103,9 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_buffer_object *bo,
else
caching = ttm_cached;
#ifdef CONFIG_SOC_SPACEMIT_K1X
caching = ttm_write_combined;
#endif
/* allocate space for the uninitialized page entries */
if (ttm_sg_tt_init(&gtt->ttm, bo, page_flags, caching)) {
kfree(gtt);

View File

@@ -588,7 +588,11 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
if (adev->gmc.xgmi.connected_to_cpu)
vres->base.bus.caching = ttm_cached;
else
#ifdef CONFIG_SOC_SPACEMIT_K1X
vres->base.bus.caching = ttm_uncached;
#else
vres->base.bus.caching = ttm_write_combined;
#endif
atomic64_add(vis_usage, &mgr->vis_usage);
*res = &vres->base;

View File

@@ -965,13 +965,21 @@ static int gmc_v10_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
#ifdef CONFIG_SOC_SPACEMIT_K1X
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(34));
#else
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
#endif
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
return r;
}
#ifdef CONFIG_SOC_SPACEMIT_K1X
adev->need_swiotlb = drm_need_swiotlb(34);
#else
adev->need_swiotlb = drm_need_swiotlb(44);
#endif
r = gmc_v10_0_mc_init(adev);
if (r)

View File

@@ -822,13 +822,21 @@ static int gmc_v11_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
#ifdef CONFIG_SOC_SPACEMIT_K1X
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(34));
#else
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(44));
#endif
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");
return r;
}
#ifdef CONFIG_SOC_SPACEMIT_K1X
adev->need_swiotlb = drm_need_swiotlb(34);
#else
adev->need_swiotlb = drm_need_swiotlb(44);
#endif
r = gmc_v11_0_mc_init(adev);
if (r)

View File

@@ -831,12 +831,20 @@ static int gmc_v6_0_sw_init(void *handle)
adev->gmc.mc_mask = 0xffffffffffULL;
#ifdef CONFIG_SOC_SPACEMIT_K1X
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(34));
#else
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
#endif
if (r) {
dev_warn(adev->dev, "No suitable DMA available.\n");
return r;
}
#ifdef CONFIG_SOC_SPACEMIT_K1X
adev->need_swiotlb = drm_need_swiotlb(34);
#else
adev->need_swiotlb = drm_need_swiotlb(40);
#endif
r = gmc_v6_0_init_microcode(adev);
if (r) {

View File

@@ -1010,12 +1010,20 @@ static int gmc_v7_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
#ifdef CONFIG_SOC_SPACEMIT_K1X
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(34));
#else
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
#endif
if (r) {
pr_warn("No suitable DMA available\n");
return r;
}
#ifdef CONFIG_SOC_SPACEMIT_K1X
adev->need_swiotlb = drm_need_swiotlb(34);
#else
adev->need_swiotlb = drm_need_swiotlb(40);
#endif
r = gmc_v7_0_init_microcode(adev);
if (r) {

View File

@@ -1123,12 +1123,20 @@ static int gmc_v8_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
#ifdef CONFIG_SOC_SPACEMIT_K1X
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(34));
#else
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(40));
#endif
if (r) {
pr_warn("No suitable DMA available\n");
return r;
}
#ifdef CONFIG_SOC_SPACEMIT_K1X
adev->need_swiotlb = drm_need_swiotlb(34);
#else
adev->need_swiotlb = drm_need_swiotlb(40);
#endif
r = gmc_v8_0_init_microcode(adev);
if (r) {

View File

@@ -2156,7 +2156,11 @@ static int gmc_v9_0_sw_init(void *handle)
*/
adev->gmc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
#ifdef CONFIG_SOC_SPACEMIT_K1X
dma_addr_bits = 34;
#else
dma_addr_bits = adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 4, 2) ? 48:44;
#endif
r = dma_set_mask_and_coherent(adev->dev, DMA_BIT_MASK(dma_addr_bits));
if (r) {
dev_warn(adev->dev, "amdgpu: No suitable DMA available.\n");

View File

@@ -288,7 +288,11 @@ static int radeon_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resourc
return -EINVAL;
mem->bus.offset += rdev->mc.aper_base;
mem->bus.is_iomem = true;
#ifdef CONFIG_SOC_SPACEMIT_K1X
mem->bus.caching = ttm_uncached;
#else
mem->bus.caching = ttm_write_combined;
#endif
#ifdef __alpha__
/*
* Alpha: use bus.addr to hold the ioremap() return,

View File

@@ -71,6 +71,8 @@ struct spacemit_hdmi {
unsigned int tmds_rate;
struct mutex lock;
bool suspended;
bool edid_done;
bool use_no_edid;
struct hdmi_data_info *hdmi_data;
@@ -752,6 +754,14 @@ spacemit_hdmi_connector_detect(struct drm_connector *connector, bool force)
DRM_DEBUG("%s() \n", __func__);
mutex_lock(&hdmi->lock);
if (hdmi->suspended) {
DRM_DEBUG("%s() hdmi is suspended\n", __func__);
mutex_unlock(&hdmi->lock);
return connector_status_disconnected;
}
mutex_unlock(&hdmi->lock);
ret = pm_runtime_get_sync(hdmi->dev);
if (ret < 0) {
DRM_INFO("%s() pm_runtime_get_sync failed\n", __func__);
@@ -976,6 +986,8 @@ static int spacemit_hdmi_bind(struct device *dev, struct device *master,
spacemit_hdmi_reset(hdmi);
hdmi->edid_done = false;
hdmi->suspended = false;
mutex_init(&hdmi->lock);
ret = spacemit_hdmi_register(drm, hdmi);
@@ -1006,6 +1018,8 @@ static void spacemit_hdmi_unbind(struct device *dev, struct device *master,
hdmi->connector.funcs->destroy(&hdmi->connector);
hdmi->encoder.funcs->destroy(&hdmi->encoder);
mutex_destroy(&hdmi->lock);
pm_runtime_put_sync(&pdev->dev);
if (!IS_ERR_OR_NULL(hdmi->hdmi_reset)) {
ret = reset_control_assert(hdmi->hdmi_reset);
@@ -1077,6 +1091,9 @@ static int hdmi_drv_pm_suspend(struct device *dev)
DRM_DEBUG("%s()\n", __func__);
mutex_lock(&hdmi->lock);
hdmi->suspended = true;
value = hdmi_readb(hdmi, SPACEMIT_HDMI_PHY_STATUS);
value &= (~SPACEMIT_HDMI_HPD_IQR_MASK);
value |= SPACEMIT_HDMI_HPD_IQR;
@@ -1084,6 +1101,7 @@ static int hdmi_drv_pm_suspend(struct device *dev)
udelay(5);
clk_disable_unprepare(hdmi->hdmi_mclk);
mutex_unlock(&hdmi->lock);
return 0;
}
@@ -1095,6 +1113,7 @@ static int hdmi_drv_pm_resume(struct device *dev)
DRM_DEBUG("%s()\n", __func__);
mutex_lock(&hdmi->lock);
clk_prepare_enable(hdmi->hdmi_mclk);
udelay(5);
@@ -1102,6 +1121,13 @@ static int hdmi_drv_pm_resume(struct device *dev)
value |= SPACEMIT_HDMI_HPD_IQR_MASK;
hdmi_writeb(hdmi, SPACEMIT_HDMI_PHY_STATUS, value);
hdmi->suspended = false;
mutex_unlock(&hdmi->lock);
if (hdmi_get_plug_in_status(hdmi)) {
drm_helper_hpd_irq_event(hdmi->connector.dev);
}
return 0;
}

View File

@@ -1542,9 +1542,6 @@ static s8 gtp_request_input_dev(struct goodix_ts_data *ts)
dev_info(&ts->client->dev, "Use type A report protocol\n");
}
input_set_capability(ts->input_dev, EV_KEY, GTP_PEN_BUTTON1);
input_set_capability(ts->input_dev, EV_KEY, GTP_PEN_BUTTON2);
/* touch key register */
for (index = 0; index < ts->pdata->key_nums; index++)
input_set_capability(ts->input_dev, EV_KEY,

View File

@@ -1385,25 +1385,25 @@ static int camsnr_of_parse(struct cam_sensor_device *sensor)
}
sensor->dphy_no = (u8) dphy_no;
sensor->afvdd = devm_regulator_get_exclusive(dev, "af_2v8");
sensor->afvdd = devm_regulator_get(dev, "af_2v8");
if (IS_ERR(sensor->afvdd)) {
cam_dbg("Failed to get regulator, guess sensor no need to control af_2v8\n");
sensor->afvdd = NULL;
}
sensor->avdd = devm_regulator_get_exclusive(dev, "avdd_2v8");
sensor->avdd = devm_regulator_get(dev, "avdd_2v8");
if (IS_ERR(sensor->avdd)) {
cam_dbg("Failed to get regulator, guess sensor no need to control avdd_2v8\n");
sensor->avdd = NULL;
}
sensor->dovdd = devm_regulator_get_exclusive(dev, "dovdd_1v8");
sensor->dovdd = devm_regulator_get(dev, "dovdd_1v8");
if (IS_ERR(sensor->dovdd)) {
cam_dbg("Failed to get regulator, guess sensor no need to control dovdd_1v8\n");
sensor->dovdd = NULL;
}
sensor->dvdd = devm_regulator_get_exclusive(dev, "dvdd_1v2");
sensor->dvdd = devm_regulator_get(dev, "dvdd_1v2");
if (IS_ERR(sensor->dvdd)) {
cam_dbg("Failed to get regulator, guess sensor no need to control dvdd_1v2\n");
sensor->dvdd = NULL;

View File

@@ -39,8 +39,6 @@ static const struct restart_config_info config_info[] = {
{"fastboot", 1},
// enter uboot shell after restart
{"uboot", 2},
// bit3 for charging flag
{"shutdown-charging", 4},
};
static const struct of_device_id spacemit_pmic_of_match[] = {
@@ -76,16 +74,6 @@ static int spacemit_restart_notify(struct notifier_block *this, unsigned long mo
int i, ret;
struct spacemit_pmic *pmic = (struct spacemit_pmic *)match_data->ptr;
for (i = 0; i < ARRAY_SIZE(config_info); ++i) {
if(!strncmp(config_info[i].cmd_para, "shutdown-charging",
sizeof("shutdown-charging"))) {
regmap_update_bits(pmic->regmap, match_data->non_reset.reg,
match_data->non_reset.bit, config_info[i].value);
break;
}
}
if (NULL != cmd) {
for (i = 0; i < ARRAY_SIZE(config_info); i++) {
if (0 == strcmp(cmd, config_info[i].cmd_para)) {

View File

@@ -1424,8 +1424,10 @@ static void spacemit_sdhci_request_done(struct sdhci_host *host,
mmc_request_done(host->mmc, mrq);
if (!(host->mmc->caps2 & MMC_CAP2_NO_SDIO))
if (!(host->mmc->caps2 & MMC_CAP2_NO_SDIO)) {
atomic_dec(&pdata->ref_count);
wake_up(&pdata->wait_queue);
}
}
static const struct sdhci_ops spacemit_sdhci_ops = {

View File

@@ -86,7 +86,7 @@ static void emac_configure_rx(struct emac_priv *priv);
static int emac_tx_mem_map(struct emac_priv *priv, struct sk_buff *skb, u32 max_tx_len, u32 frag_num);
static int emac_tx_clean_desc(struct emac_priv *priv);
static int emac_rx_clean_desc(struct emac_priv *priv, int budget);
static void emac_alloc_rx_desc_buffers(struct emac_priv *priv);
static int emac_alloc_rx_desc_buffers(struct emac_priv *priv);
static int emac_phy_connect(struct net_device *dev);
static int emac_sw_init(struct emac_priv *priv);
@@ -433,7 +433,11 @@ static int emac_up(struct emac_priv *priv)
emac_configure_rx(priv);
/* allocate buffers for receive descriptors */
emac_alloc_rx_desc_buffers(priv);
ret = emac_alloc_rx_desc_buffers(priv);
if (ret) {
pr_err("%s alloc rx desc buffers failed\n", __func__);
goto err;
}
if (ndev->phydev)
phy_start(ndev->phydev);
@@ -786,48 +790,54 @@ static int emac_rx_clean_desc(struct emac_priv *priv, int budget)
rx_buf->dma_len, DMA_FROM_DEVICE);
status = emac_rx_frame_status(priv, rx_desc);
if (unlikely(status == frame_discard)) {
dev_kfree_skb_irq(rx_buf->skb);
rx_buf->skb = NULL;
} else {
if (likely(status != frame_discard)) {
skb = rx_buf->skb;
skb_len = rx_desc->FramePacketLength - ETHERNET_FCS_SIZE;
ecdev_receive(priv->ecdev,skb->data,skb_len);
dev_kfree_skb_irq(rx_buf->skb);
rx_buf->skb = NULL;
ecdev_receive(priv->ecdev, skb->data, skb_len);
}
if (++i == rx_ring->total_cnt)
rx_buf->dma_addr = dma_map_single(&priv->pdev->dev,
skb->data,
priv->dma_buf_sz,
DMA_FROM_DEVICE);
memset(rx_desc, 0, sizeof(struct emac_rx_desc));
rx_desc->BufferAddr1 = rx_buf->dma_addr;
rx_desc->BufferSize1 = rx_buf->dma_len;
if (++i == rx_ring->total_cnt) {
rx_desc->EndRing = 1;
i = 0;
}
dma_wmb();
rx_desc->OWN = 1;
}
rx_ring->tail = i;
emac_alloc_rx_desc_buffers(priv);
return receive_packet;
}
/* Name emac_alloc_rx_desc_buffers
* Arguments priv : pointer to driver private data structure
* Return 1: Cleaned; 0:Failed
* Return -1: fail; 0:success
* Description
*/
static void emac_alloc_rx_desc_buffers(struct emac_priv *priv)
static int emac_alloc_rx_desc_buffers(struct emac_priv *priv)
{
struct net_device *ndev = priv->ndev;
struct emac_desc_ring *rx_ring = &priv->rx_ring;
struct emac_desc_buffer *rx_buf;
struct sk_buff *skb;
struct sk_buff *skb = NULL;
struct emac_rx_desc *rx_desc;
u32 i;
i = rx_ring->head;
rx_buf = &rx_ring->desc_buf[i];
for (int i = 0; i < rx_ring->total_cnt; ++i) {
rx_buf = &rx_ring->desc_buf[i];
while (!rx_buf->skb) {
skb = netdev_alloc_skb_ip_align(ndev, priv->dma_buf_sz);
if (!skb) {
pr_err("sk_buff allocation failed\n");
break;
goto err_out;
}
skb->dev = ndev;
@@ -840,7 +850,9 @@ static void emac_alloc_rx_desc_buffers(struct emac_priv *priv)
DMA_FROM_DEVICE);
if (dma_mapping_error(&priv->pdev->dev, rx_buf->dma_addr)) {
netdev_err(ndev, "dma mapping_error\n");
goto dma_map_err;
dev_kfree_skb_any(skb);
rx_buf->skb = NULL;
goto err_out;
}
rx_desc = &((struct emac_rx_desc *)rx_ring->desc_addr)[i];
@@ -852,25 +864,19 @@ static void emac_alloc_rx_desc_buffers(struct emac_priv *priv)
rx_desc->FirstDescriptor = 0;
rx_desc->LastDescriptor = 0;
if (++i == rx_ring->total_cnt) {
if (i == rx_ring->total_cnt - 1)
rx_desc->EndRing = 1;
i = 0;
}
dma_wmb();
rx_desc->OWN = 1;
rx_buf = &rx_ring->desc_buf[i];
}
rx_ring->head = i;
return;
dma_map_err:
dev_kfree_skb_any(skb);
rx_buf->skb = NULL;
return;
return 0;
err_out:
emac_clean_rx_desc_ring(priv);
return -1;
}
/* Name emac_tx_mem_map
* Arguments priv : pointer to driver private data structure
* pstSkb : pointer to sk_buff structure passed by upper layer
@@ -1590,7 +1596,7 @@ static int emac_probe(struct platform_device *pdev)
priv->reset = devm_reset_control_get_optional(&pdev->dev, NULL);
if (IS_ERR(priv->reset)) {
dev_err(&pdev->dev, "Failed to get emac's resets\n");
goto mac_clk_disable;
goto phy_clk_disable;
}
reset_control_deassert(priv->reset);
@@ -1626,6 +1632,9 @@ err_mdio_deinit:
emac_mdio_deinit(priv);
reset_assert:
reset_control_assert(priv->reset);
phy_clk_disable:
if (priv->ref_clk_frm_soc)
clk_disable_unprepare(priv->phy_clk);
mac_clk_disable:
clk_disable_unprepare(priv->mac_clk);
err_netdev:

View File

@@ -1990,6 +1990,11 @@ static struct rtw_phl_scan_param *_alloc_phl_param(_adapter *adapter, u8 scan_ch
struct rtw_phl_scan_param *phl_param = NULL;
struct scan_priv *scan_priv = NULL;
if (adapter->phl_role == NULL) {
RTW_ERR(FUNC_ADPT_FMT" phl_role == NULL\n", FUNC_ADPT_ARG(adapter));
goto _err_exit;
}
if (scan_ch_num == 0) {
RTW_ERR("%s scan_ch_num = 0\n", __func__);
goto _err_exit;

View File

@@ -2732,17 +2732,19 @@ u32 mac_wow_dbg_dump(struct mac_ax_adapter *adapter)
#if MAC_AX_FEATURE_DBGPKG
ret = fw_st_dbg_dump(adapter);
if (ret) {
PLTFM_MSG_ERR("fw_st_dbg_dump fail (%d)\n", ret);
return ret;
}
if (ret) {
PLTFM_MSG_ERR("fw_st_dbg_dump fail (%d)\n", ret);
PLTFM_MUTEX_UNLOCK(&adapter->lock_info.err_get_lock);
return ret;
}
#endif
#if MAC_AX_FEATURE_DBGPKG
ret = mac_dump_err_status(adapter, HALT_C2H_L1_DBG_MODE);
if (ret) {
PLTFM_MSG_ERR("mac_dump_err_status fail (%d)\n", ret);
return ret;
}
if (ret) {
PLTFM_MSG_ERR("mac_dump_err_status fail (%d)\n", ret);
PLTFM_MUTEX_UNLOCK(&adapter->lock_info.err_get_lock);
return ret;
}
#endif
PLTFM_MUTEX_UNLOCK(&adapter->lock_info.err_get_lock);
return ret;

View File

@@ -995,6 +995,12 @@ enum rtw_phl_status rtw_phl_init(void *drv_priv, void **phl,
goto error_vers_check;
}
if (false == rtw_phl_regu_interface_init(phl_info)) {
phl_status = RTW_PHL_STATUS_HAL_INIT_FAILURE;
PHL_ERR("rtw_phl_regu_interface_init failed\n");
goto error_phl_regu_interface_init;
}
hal_status = rtw_hal_init(drv_priv, phl_info->phl_com,
&(phl_info->hal), ic_info->ic_id);
if ((hal_status != RTW_HAL_STATUS_SUCCESS) || (phl_info->hal == NULL)) {
@@ -1096,8 +1102,10 @@ error_phl_var_init:
error_hal_var_init:
error_hal_read_chip_info:
rtw_hal_deinit(phl_info->phl_com, phl_info->hal);
error_vers_check:
error_hal_init:
rtw_phl_regu_interface_deinit(phl_info);
error_phl_regu_interface_init:
error_vers_check:
#ifdef CONFIG_RTW_ACS
phl_acs_info_deinit(phl_info);
error_phl_acs_info_init:
@@ -1156,6 +1164,7 @@ void rtw_phl_deinit(void *phl)
phl_qm_deinit(phl_info);
#endif /* CONFIG_QOS_MG */
rtw_hal_deinit(phl_info->phl_com, phl_info->hal);
rtw_phl_regu_interface_deinit(phl_info);
phl_var_deinit(phl_info);
#ifdef CONFIG_FSM
phl_fsm_module_deinit(phl_info);

View File

@@ -1547,6 +1547,19 @@ static int k1x_power_on(struct k1x_pcie *k1x, int on)
return 0;
}
static void k1x_pcie_hold_phy_rst(struct k1x_pcie *k1x)
{
u32 reg;
reg = k1x_pcie_readl(k1x, PCIECTRL_K1X_CONF_DEVICE_CMD);
if (reg & APP_HOLD_PHY_RST) {
dev_dbg(k1x->pci->dev, "k1x_pcie_hold_phy_rst: phy reset already held\n");
return;
}
reg |= APP_HOLD_PHY_RST;
k1x_pcie_writel(k1x, PCIECTRL_K1X_CONF_DEVICE_CMD, reg);
}
static int k1x_pcie_probe(struct platform_device *pdev)
{
u32 reg;
@@ -1650,6 +1663,8 @@ static int k1x_pcie_probe(struct platform_device *pdev)
k1x->pci = pci;
platform_set_drvdata(pdev, k1x);
k1x_pcie_hold_phy_rst(k1x);
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
pm_runtime_get_noresume(&pdev->dev);
@@ -1818,6 +1833,8 @@ static int k1x_pcie_resume_noirq(struct device *dev)
struct dw_pcie_rp *pp = &pci->pp;
u32 reg;
k1x_pcie_hold_phy_rst(k1x);
/* soft no reset */
reg = k1x_pcie_readl(k1x, PCIE_CTRL_LOGIC);
reg &= ~(1 << 0);

View File

@@ -1067,6 +1067,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
min_align = calculate_mem_align(aligns, max_order);
min_align = max(min_align, window_alignment(bus, b_res->flags));
size0 = calculate_memsize(size, min_size, 0, 0, resource_size(b_res), min_align);
#ifdef CONFIG_SOC_SPACEMIT_K1X
if (size0 == 0x18000000U)
size0 = 0x16000000U;
#endif
add_align = max(min_align, add_align);
size1 = (!realloc_head || (realloc_head && !add_size && !children_add_size)) ? size0 :
calculate_memsize(size, min_size, add_size, children_add_size,

View File

@@ -501,6 +501,9 @@ static const struct pinmux_ops pcs_pinmux_ops = {
.get_function_groups = pinmux_generic_get_function_groups,
.set_mux = pcs_set_mux,
.gpio_request_enable = pcs_request_gpio,
#ifdef CONFIG_SOC_SPACEMIT_K1X
.strict = true,
#endif
};
/* Clear BIAS value */

View File

@@ -250,7 +250,11 @@ static u64 rproc_virtio_get_features(struct virtio_device *vdev)
rsc = (void *)rvdev->rproc->table_ptr + rvdev->rsc_offset;
#ifdef CONFIG_SOC_SPACEMIT_K1X
return (u64)rsc->dfeatures | ((u64)rsc->gfeatures << 32);
#else
return rsc->dfeatures;
#endif
}
static void rproc_transport_features(struct virtio_device *vdev)
@@ -277,8 +281,9 @@ static int rproc_virtio_finalize_features(struct virtio_device *vdev)
rproc_transport_features(vdev);
/* Make sure we don't have any features > 32 bits! */
#ifndef CONFIG_SOC_SPACEMIT_K1X
BUG_ON((u32)vdev->features != vdev->features);
#endif
/*
* Remember the finalized features of our vdev, and provide it
* to the remote processor once it is powered on.

View File

@@ -87,6 +87,7 @@ struct spacemit_rproc {
void __iomem *base[MAX_MEM_BASE];
struct spacemit_mbox *mb;
char *verid;
unsigned int size;
#ifdef CONFIG_PM_SLEEP
struct rpmsg_device *rpdev;
#ifdef CONFIG_HIBERNATION
@@ -177,21 +178,12 @@ static int spacemit_rproc_prepare(struct rproc *rproc)
da = rmem->base;
}
if (strcmp(it.node->name, "vdev0buffer")) {
mem = rproc_mem_entry_init(dev, NULL,
rmem->base,
rmem->size, da,
spacemit_rproc_mem_alloc,
spacemit_rproc_mem_release,
it.node->name);
} else {
/* Register reserved memory for vdev buffer alloc */
mem = rproc_of_resm_mem_entry_init(dev, index,
rmem->size,
rmem->base,
it.node->name);
}
mem = rproc_mem_entry_init(dev, NULL,
rmem->base,
rmem->size, da,
spacemit_rproc_mem_alloc,
spacemit_rproc_mem_release,
it.node->name);
if (!mem)
return -ENOMEM;
@@ -264,7 +256,7 @@ static int spacemit_rproc_start(struct rproc *rproc)
struct spacemit_rproc *priv = rproc->priv;
if (priv->verid != NULL)
pr_notice("the firmare version id is:%s\n", priv->verid);
pr_notice("the firmare version id is:%s\n", rproc_da_to_va(rproc, (u64)priv->verid, priv->size, NULL));
/* enable ipc2ap clk & reset--> rcpu side */
writel(0xff, priv->base[BOOTC_MEM_BASE_OFFSET] + ESOS_AON_PER_CLK_RST_CTL_REG);
@@ -300,7 +292,7 @@ static int spacemit_rproc_parse_fw(struct rproc *rproc, const struct firmware *f
int ret;
u64 sh_size;
struct spacemit_rproc *ddata = rproc->priv;
char *version_id_table, *version_id_va;
char *version_id_table;
ddata->verid = NULL;
/* find the firmare id */
@@ -308,10 +300,8 @@ static int spacemit_rproc_parse_fw(struct rproc *rproc, const struct firmware *f
if (!version_id_table) {
dev_info(&rproc->dev, "Can not find version id table\n");
} else {
version_id_va = ioremap((phys_addr_t)version_id_table, sh_size);
ddata->verid = version_id_va;
ddata->verid = version_id_table;
ddata->size = sh_size;
}
ret = rproc_elf_load_rsc_table(rproc, fw);

View File

@@ -277,6 +277,7 @@ static const struct spacemit_reset_signal
[RESET_SDH1] = { APMU_SDH1_CLK_RES_CTRL, BIT(1), BIT(1), 0, RST_BASE_TYPE_APMU },
[RESET_USB_AXI] = { APMU_USB_CLK_RES_CTRL, BIT(0), BIT(0), 0, RST_BASE_TYPE_APMU },
[RESET_USBP1_AXI] = { APMU_USB_CLK_RES_CTRL, BIT(4), BIT(4), 0, RST_BASE_TYPE_APMU },
[RESET_COMBO_PHY] = { APMU_PCIE_CLK_RES_CTRL_0, BIT(8), 0, BIT(8), RST_BASE_TYPE_APMU },
[RESET_USB3_0] = { APMU_USB_CLK_RES_CTRL, BIT(9)|BIT(10)|BIT(11), BIT(9)|BIT(10)|BIT(11), 0, RST_BASE_TYPE_APMU },
[RESET_QSPI] = { APMU_QSPI_CLK_RES_CTRL, BIT(1), BIT(1), 0, RST_BASE_TYPE_APMU },
[RESET_QSPI_BUS] = { APMU_QSPI_CLK_RES_CTRL, BIT(0), BIT(0), 0, RST_BASE_TYPE_APMU },
@@ -570,4 +571,3 @@ out:
}
CLK_OF_DECLARE(k1x_reset, "spacemit,k1x-reset", spacemit_reset_init);

View File

@@ -50,6 +50,8 @@
#define HUSB239_REG_SRC_PDO_5V 0x6A
#define HUSB239_REG_SRC_PDO_9V 0x6B
#define HUSB239_REG_SRC_PDO_12V 0x6C
#define HUSB239_REG_SRC_PDO_15V 0x6D
#define HUSB239_REG_SRC_PDO_20V 0x6E
#define HUSB239_REG_MAX 0xFF
@@ -156,6 +158,8 @@
#define HUSB239_PD_COMM(s) (!!((s) & BIT(4)))
#define HUSB239_POWER_ROLE(s) (!!((s) & BIT(6)))
#define PD_DEETCT_DELAY_MS 1000
enum husb239_snkcap {
SNKCAP_5V = 1,
SNKCAP_9V,
@@ -204,6 +208,7 @@ struct husb239 {
struct gpio_desc *int_gpiod;
int gpio_irq;
struct work_struct work;
struct delayed_work pd_work;
struct workqueue_struct *workqueue;
struct mutex lock;
@@ -347,10 +352,15 @@ static void husb239_update_operating_status(struct husb239 *husb239)
else
op_current = 3000 + (status1 - STEP_BOUNDARY) * 40;
/* covert mV/mA to uV/uA */
husb239->voltage = voltage * 1000;
husb239->op_current = op_current * 1000;
husb239->psy_online = true;
if ((husb239->voltage != voltage * 1000)
|| (husb239->op_current != op_current * 1000)) {
/* covert mV/mA to uV/uA */
husb239->voltage = voltage * 1000;
husb239->op_current = op_current * 1000;
husb239->psy_online = true;
goto out;
}
return;
out:
dev_info(husb239->dev, "update sink voltage: %d current: %d\n", husb239->voltage, husb239->op_current);
@@ -456,9 +466,9 @@ static int husb239_usbpd_detect(struct husb239 *husb239)
return ret;
dev_dbg(husb239->dev, "husb239 detect pd, contract status0: %x\n", status0);
if (((status0 & HUSB239_PD_CONTRACT_MASK) >> HUSB239_PD_CONTRACT_SHIFT) == SNKCAP_5V) {
if (((status0 & HUSB239_PD_CONTRACT_MASK) >> HUSB239_PD_CONTRACT_SHIFT)) {
husb239_update_operating_status(husb239);
break;
return 0;
}
/* check attach status */
ret = regmap_read(husb239->regmap, HUSB239_REG_STATUS, &status);
@@ -512,30 +522,30 @@ static int husb239_usbpd_request_voltage(struct husb239 *husb239)
break;
}
while(--count) {
ret = regmap_read(husb239->regmap, HUSB239_REG_SRC_PDO_5V + snk_sel - 1, &src_pdo);
if (ret)
return ret;
for (; snk_sel >= SNKCAP_5V; snk_sel--) {
for (count = 10; count > 0; count--) {
ret = regmap_read(husb239->regmap, HUSB239_REG_SRC_PDO_5V + snk_sel - 1, &src_pdo);
if (ret)
return ret;
dev_dbg(husb239->dev, "husb239_attach src_pdo: %x\n", src_pdo);
if (src_pdo & HUSB239_REG_SRC_DETECT)
break;
dev_dbg(husb239->dev, "husb239_attach src_pdo: %x\n", src_pdo);
if (src_pdo & HUSB239_REG_SRC_DETECT)
goto pd_detect;
/* check attach status */
ret = regmap_read(husb239->regmap, HUSB239_REG_STATUS, &status);
if (ret)
return ret;
/* check attach status */
ret = regmap_read(husb239->regmap, HUSB239_REG_STATUS, &status);
if (ret)
return ret;
if (!(status & HUSB239_REG_STATUS_ATTACH))
return -ENODEV;
if (!(status & HUSB239_REG_STATUS_ATTACH))
return -ENODEV;
msleep(100);
msleep(100);
}
}
if (count == 0)
return -EINVAL;
dev_info(husb239->dev, "pd detect \n");
pd_detect:
dev_info(husb239->dev, "pd detect, snk_sel: %d\n", snk_sel);
ret = regmap_update_bits(husb239->regmap, HUSB239_REG_SRC_PDO,
HUSB239_REG_SRC_PDO_SEL_MASK, (snk_sel << 3));
if (ret)
@@ -567,6 +577,8 @@ static int husb239_usbpd_request_voltage(struct husb239 *husb239)
if (ret)
return ret;
queue_delayed_work(husb239->workqueue,
&husb239->pd_work, msecs_to_jiffies(PD_DEETCT_DELAY_MS));
return ret;
}
@@ -810,6 +822,17 @@ static int husb239_chip_init(struct husb239 *husb239)
return 0;
}
static void husb239_pd_func(struct work_struct *work)
{
struct husb239 *husb239 = container_of(work, struct husb239, pd_work.work);
mutex_lock(&husb239->lock);
husb239_update_operating_status(husb239);
mutex_unlock(&husb239->lock);
return;
}
static void husb239_work_func(struct work_struct *work)
{
struct husb239 *husb239 = container_of(work, struct husb239, work);
@@ -856,6 +879,7 @@ static int husb239_irq_init(struct husb239 *husb239)
int ret, status;
INIT_WORK(&husb239->work, husb239_work_func);
INIT_DELAYED_WORK(&husb239->pd_work, husb239_pd_func);
husb239->workqueue = alloc_workqueue("husb239_work",
WQ_FREEZABLE |
WQ_MEM_RECLAIM,
@@ -1285,6 +1309,9 @@ static void husb239_remove(struct i2c_client *client)
struct husb239 *husb239 = i2c_get_clientdata(client);
struct typec_info *info = &husb239->info;
cancel_work_sync(&husb239->work);
cancel_delayed_work_sync(&husb239->pd_work);
if (husb239->workqueue)
destroy_workqueue(husb239->workqueue);
@@ -1303,6 +1330,10 @@ static int __maybe_unused husb239_suspend(struct device *dev)
{
struct husb239 *husb239 = dev_get_drvdata(dev);
/* Make sure any pending irq work is finished before suspends */
flush_work(&husb239->work);
flush_delayed_work(&husb239->pd_work);
/* Clear all interruption */
regmap_write(husb239->regmap, HUSB239_REG_INT, 0xFF);
regmap_write(husb239->regmap, HUSB239_REG_INT1, 0xFF);
@@ -1313,6 +1344,10 @@ static int __maybe_unused husb239_suspend(struct device *dev)
static int __maybe_unused husb239_resume(struct device *dev)
{
struct husb239 *husb239 = dev_get_drvdata(dev);
queue_delayed_work(husb239->workqueue,
&husb239->pd_work, msecs_to_jiffies(PD_DEETCT_DELAY_MS));
return 0;
}

View File

@@ -84,54 +84,55 @@
#define RESET_SDH1 73
#define RESET_USB_AXI 74
#define RESET_USBP1_AXI 75
#define RESET_USB3_0 76
#define RESET_QSPI 77
#define RESET_QSPI_BUS 78
#define RESET_DMA 79
#define RESET_AES 80
#define RESET_VPU 81
#define RESET_GPU 82
#define RESET_SDH2 83
#define RESET_MC 84
#define RESET_EM_AXI 85
#define RESET_EM 86
#define RESET_AUDIO_SYS 87
#define RESET_HDMI 88
#define RESET_PCIE0 89
#define RESET_PCIE1 90
#define RESET_PCIE2 91
#define RESET_EMAC0 92
#define RESET_EMAC1 93
#define RESET_COMBO_PHY 76
#define RESET_USB3_0 77
#define RESET_QSPI 78
#define RESET_QSPI_BUS 79
#define RESET_DMA 80
#define RESET_AES 81
#define RESET_VPU 82
#define RESET_GPU 83
#define RESET_SDH2 84
#define RESET_MC 85
#define RESET_EM_AXI 86
#define RESET_EM 87
#define RESET_AUDIO_SYS 88
#define RESET_HDMI 89
#define RESET_PCIE0 90
#define RESET_PCIE1 91
#define RESET_PCIE2 92
#define RESET_EMAC0 93
#define RESET_EMAC1 94
//APBC2
#define RESET_SEC_UART1 94
#define RESET_SEC_SSP2 95
#define RESET_SEC_TWSI3 96
#define RESET_SEC_RTC 97
#define RESET_SEC_TIMERS0 98
#define RESET_SEC_KPC 99
#define RESET_SEC_GPIO 100
#define RESET_SEC_UART1 95
#define RESET_SEC_SSP2 96
#define RESET_SEC_TWSI3 97
#define RESET_SEC_RTC 98
#define RESET_SEC_TIMERS0 99
#define RESET_SEC_KPC 100
#define RESET_SEC_GPIO 101
#define RESET_RCPU_HDMIAUDIO 101
#define RESET_RCPU_CAN 102
#define RESET_RCPU_HDMIAUDIO 102
#define RESET_RCPU_CAN 103
#define RESET_RCPU_I2C0 103
#define RESET_RCPU_SSP0 104
#define RESET_RCPU_IR 105
#define RESET_RCPU_UART0 106
#define RESET_RCPU_UART1 107
#define RESET_RCPU_I2C0 104
#define RESET_RCPU_SSP0 105
#define RESET_RCPU_IR 106
#define RESET_RCPU_UART0 107
#define RESET_RCPU_UART1 108
#define RESET_RCPU2_PWM0 108
#define RESET_RCPU2_PWM1 109
#define RESET_RCPU2_PWM2 110
#define RESET_RCPU2_PWM3 111
#define RESET_RCPU2_PWM4 112
#define RESET_RCPU2_PWM5 113
#define RESET_RCPU2_PWM6 114
#define RESET_RCPU2_PWM7 115
#define RESET_RCPU2_PWM8 116
#define RESET_RCPU2_PWM9 117
#define RESET_RCPU2_PWM0 109
#define RESET_RCPU2_PWM1 110
#define RESET_RCPU2_PWM2 111
#define RESET_RCPU2_PWM3 112
#define RESET_RCPU2_PWM4 113
#define RESET_RCPU2_PWM5 114
#define RESET_RCPU2_PWM6 115
#define RESET_RCPU2_PWM7 116
#define RESET_RCPU2_PWM8 117
#define RESET_RCPU2_PWM9 118
#define RESET_NUMBER 118
#define RESET_NUMBER 119
#endif /* __DT_BINDINGS_RESET_SAPCEMIT_K1X_H__ */

View File

@@ -1,65 +1,319 @@
#!/bin/bash -e
SCRIPT="./scripts/build_kernel.sh"
PACKAGE_SRC_NAME="linux-riscv-spacemit"
CLEAN_CMD="make distclean &&
VERSION=\$(grep -oP '^VERSION\\s*=\\s*\\K\\d+' Makefile)
PATCHLEVEL=\$(grep -oP '^PATCHLEVEL\\s*=\\s*\\K\\d+' Makefile)
SUBLEVEL=\$(grep -oP '^SUBLEVEL\\s*=\\s*\\K\\d+' Makefile)
export KERNELRELEASE=\$VERSION.\$PATCHLEVEL.\$SUBLEVEL &&
rm -f ../linux-headers-\$KERNELRELEASE_*_riscv64.deb &&
rm -f ../linux-image-\$KERNELRELEASE_*_riscv64.deb &&
rm -f ../linux-image-\$KERNELRELEASE-dbg_*_riscv64.deb &&
rm -f ../linux-tools-\$KERNELRELEASE_*_riscv64.deb &&
rm -f ../linux-libc-dev_*_riscv64.deb &&
rm -f ../linux-tools-common_*_all.deb &&
rm -f ../linux-riscv-spacemit_*_riscv64.*
"
BUILD_CMD='make k1_defconfig && make -j$(nproc)'
BUILD_DEB_CMD="make k1_defconfig &&
sed -i '/CONFIG_INITRAMFS_SOURCE=/d' arch/riscv/configs/k1_defconfig
VERSION=\$(grep -oP '^VERSION\\s*=\\s*\\K\\d+' Makefile)
PATCHLEVEL=\$(grep -oP '^PATCHLEVEL\\s*=\\s*\\K\\d+' Makefile)
SUBLEVEL=\$(grep -oP '^SUBLEVEL\\s*=\\s*\\K\\d+' Makefile)
export KERNELRELEASE=\$VERSION.\$PATCHLEVEL.\$SUBLEVEL
export LOCALVERSION=\"\"
KDEB_SOURCENAME=$PACKAGE_SRC_NAME \\
KDEB_PKGVERSION=\$KERNELRELEASE-\$(TZ=Asia/Shanghai date +\"%Y%m%d%H%M%S\") \\
KDEB_CHANGELOG_DIST=noble-porting \\
make -j\$(nproc) bindeb-pkg
"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
SOURCE_PARENT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
DOCKER_REPO="${DOCKER_REPO:-harbor.spacemit.com/bianbu-linux}"
IMAGE_NAME="${IMAGE_NAME:-bianbu-linux-builder:latest}"
CROSS_COMPILE="${CROSS_COMPILE:-riscv64-unknown-linux-gnu-}"
TOOLCHAIN_PATH="${TOOLCHAIN_PATH:-/opt/spacemit-toolchain-linux-glibc-x86_64-v1.0.0/bin}"
DIRECT_BUILD="${DIRECT_BUILD:-0}"
CLEAN=false
BUILD_DEB=false
ACTION="build"
DEBUG=false
while getopts "cdh" opt
do
case $opt in
c)
# Function to handle symlinks within git directory
handle_git_internal_symlinks() {
local git_dir="$1"
local container_git_dir="$2"
local -n git_mounts_ref="$3" # Reference to the git mounts array
[ "$DEBUG" = true ] && echo "Scanning for symlinks in git directory: $git_dir"
# Find all symlinks in the git directory
while IFS= read -r -d '' symlink; do
if [ -L "$symlink" ]; then
local real_target
real_target="$(readlink -f "$symlink")"
local relative_path="${symlink#$git_dir/}"
local container_target="$container_git_dir/$relative_path"
if [ -e "$real_target" ]; then
[ "$DEBUG" = true ] && echo "Found symlink: $relative_path -> $real_target"
# Store mounts in the array - add both -v and the mount path
git_mounts_ref+=("-v" "$real_target:$container_target")
else
[ "$DEBUG" = true ] && echo "Warning: Broken symlink found: $symlink -> $real_target"
fi
fi
done < <(find "$git_dir" -type l -print0 2>/dev/null)
}
# Function to setup all container volume mounts (including git handling)
setup_volume_mounts() {
local project_dir="$1"
local package_dir="$2"
local git_path="$package_dir/.git"
local container_base
container_base="/workspace/$(basename "$package_dir")"
# Local git_mounts array for this function
local git_mounts=()
[ "$DEBUG" = true ] && echo "Setting up container volume mounts..."
# Initialize with basic mounts
VOLUME_MOUNTS=("-v" "$project_dir:/workspace" "-w" "$container_base")
# Handle git directory if exists
if [ -e "$git_path" ]; then
local actual_git_dir
local container_git_path="$container_base/.git"
if [ -L "$git_path" ]; then
[ "$DEBUG" = true ] && echo "Detected .git as symbolic link, resolving real git directory..."
actual_git_dir="$(readlink -f "$git_path")"
if [ ! -d "$actual_git_dir" ]; then
echo "Error: Cannot find real git directory: $actual_git_dir"
echo "Please ensure the git repository is accessible."
exit 1
fi
# Set up main git directory mount
git_mounts+=("-v" "$actual_git_dir:$container_git_path")
[ "$DEBUG" = true ] && echo "Will mount real git directory: $actual_git_dir -> $container_git_path"
elif [ -d "$git_path" ]; then
[ "$DEBUG" = true ] && echo "Found normal .git directory"
actual_git_dir="$git_path"
# For normal directories, no additional mount needed as it's part of the main project mount
else
[ "$DEBUG" = true ] && echo "Warning: .git exists but is neither a directory nor a symlink"
actual_git_dir=""
fi
# Handle symlinks within the git directory
if [ -n "$actual_git_dir" ]; then
handle_git_internal_symlinks "$actual_git_dir" "$container_git_path" git_mounts
fi
else
[ "$DEBUG" = true ] && echo "Warning: No .git directory found, some git operations may fail"
fi
# Add all git mounts (both main directory and internal symlinks)
if [ ${#git_mounts[@]} -gt 0 ]; then
VOLUME_MOUNTS+=("${git_mounts[@]}")
[ "$DEBUG" = true ] && echo "Added $(( ${#git_mounts[@]} / 2 )) git-related mounts"
fi
[ "$DEBUG" = true ] && echo "Total volume mounts configured: $(( (${#VOLUME_MOUNTS[@]} + 1) / 2 ))"
# fix this function will exit if bash set -e
return 0
}
# Setup container volume mounts (includes git handling)
setup_volume_mounts "$SOURCE_PARENT_DIR" "$SOURCE_DIR"
usage() {
echo "Container-based build wrapper (universal version)"
echo "Usage: $(basename "$0") [OPTIONS] [COMMAND]"
echo ""
echo "Options:"
echo " -c, --clean Clean build (CLEAN_CMD before BUILD[_DEB]_CMD)"
echo " -d, --deb Build DEB packages (BUILD_DEB_CMD)"
echo " -h, --help Show this help message"
echo " -x, --debug Enable debug output (show docker command)"
echo ""
echo "Commands (run inside container):"
echo " build Build (BUILD_CMD, default)"
echo " shell Interactive shell"
echo ""
echo "Examples:"
echo " $(basename "$0") # Build in container"
echo " $(basename "$0") -c -d # Clean build with DEB packages"
echo " $(basename "$0") shell # Interactive container shell"
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-c|--clean)
CLEAN=true
shift
;;
d)
-d|--deb)
BUILD_DEB=true
shift
;;
?)
echo "Usage: Run on the top of linux directory"
echo "$SCRIPT [-c] [-d]"
-h|--help)
usage
exit 0
;;
-x|--debug)
DEBUG=true
shift
;;
build|shell)
ACTION="$1"
shift
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
done
if [ $0 != $SCRIPT ]
then
echo "Run $(basename $SCRIPT) on the top of linux directory"
# Check if Docker is available
if ! command -v docker &> /dev/null; then
echo "Error: Docker not found. Please install Docker."
exit 1
fi
command -v riscv64-unknown-linux-gnu-gcc > /dev/null || \
(echo "Install cross compile and add to PATH" && exit 1)
VERSION=$(grep -oP '^VERSION\s*=\s*\K\d+' Makefile)
PATCHLEVEL=$(grep -oP '^PATCHLEVEL\s*=\s*\K\d+' Makefile)
SUBLEVEL=$(grep -oP '^SUBLEVEL\s*=\s*\K\d+' Makefile)
export ARCH=riscv
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
export KERNELRELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL
export LOCALVERSION=""
if [ $CLEAN = true ]
then
make distclean
if [ $BUILD_DEB = true ]
then
rm -f ../linux-headers-$KERNELRELEASE_*_riscv64.deb
rm -f ../linux-image-$KERNELRELEASE_*_riscv64.deb
rm -f ../linux-image-$KERNELRELEASE-dbg_*_riscv64.deb
rm -f ../linux-libc-dev_*_riscv64.deb
rm -f ../linux-riscv-spacemit_*_riscv64.*
# Set DEBEMAIL and DEBFULLNAME environment variable
if [ -z "$DEBEMAIL" ]; then
if [ -n "$MAIL" ]; then
DEBEMAIL="$MAIL"
else
DEBEMAIL="$(id -nu)@$(hostname -f 2>/dev/null || hostname)"
fi
fi
make k1_defconfig
if [ $BUILD_DEB = true ]
then
KDEB_SOURCENAME=linux-riscv-spacemit \
KDEB_PKGVERSION=$KERNELRELEASE-$(TZ=Asia/Shanghai date +"%Y%m%d%H%M%S") \
KDEB_CHANGELOG_DIST=mantic-porting \
make -j$(nproc) bindeb-pkg
else
make -j$(nproc)
if [ -z "$DEBFULLNAME" ]; then
if [ -n "$NAME" ]; then
DEBFULLNAME="$NAME"
elif echo "$DEBEMAIL" | grep -qE '^([^<]+)\s*<[^>]+>$'; then
# If DEBEMAIL matches "name <email>", extract name as DEBFULLNAME
DEBFULLNAME="$(echo "$DEBEMAIL" | sed -n 's/^\([^<][^<]*\)<.*$/\1/p' | sed 's/[[:space:]]*$//')"
else
DEBFULLNAME="$(id -nu)"
fi
fi
CONTAINER_ENV=("-e" "ARCH=riscv" "-e" "CROSS_COMPILE=$CROSS_COMPILE" "-e" "PATH=$TOOLCHAIN_PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" "-e" "DEBEMAIL=$DEBEMAIL" "-e" "DEBFULLNAME=$DEBFULLNAME")
# Function to create user permission files for container
create_user_files() {
local current_user current_group
current_user="$(whoami):x:$(id -u):$(id -g):$(whoami),,,:/home/$(whoami):/bin/bash"
current_group="$(id -gn):x:$(id -g):"
# Create or update .passwd and .group files
if [ ! -f "$SOURCE_DIR/.passwd" ] || \
[ ! -f "$SOURCE_DIR/.group" ] || \
[ "$current_user" != "$(grep "^$(whoami):" "$SOURCE_DIR/.passwd" 2>/dev/null)" ] || \
[ "$current_group" != "$(grep "^$(id -gn):" "$SOURCE_DIR/.group" 2>/dev/null)" ]; then
cp /etc/passwd "$SOURCE_DIR/.passwd.tmp"
cp /etc/group "$SOURCE_DIR/.group.tmp"
if ! grep -q "^$(whoami):" "$SOURCE_DIR/.passwd.tmp"; then
echo "$current_user" >> "$SOURCE_DIR/.passwd.tmp"
fi
if ! grep -q "^$(id -gn):" "$SOURCE_DIR/.group.tmp"; then
echo "$current_group" >> "$SOURCE_DIR/.group.tmp"
fi
mv "$SOURCE_DIR/.passwd.tmp" "$SOURCE_DIR/.passwd"
mv "$SOURCE_DIR/.group.tmp" "$SOURCE_DIR/.group"
fi
}
# Create user permission files
create_user_files
# Function to run command in container
run_in_container() {
local cmd="$1"
if [ "$DEBUG" = true ]; then
echo "--- Docker/Podman full command ---"
local full_cmd
full_cmd="docker run --rm -it --init"
for v in "${VOLUME_MOUNTS[@]}"; do
full_cmd+=" $v"
done
for e in "${CONTAINER_ENV[@]}"; do
full_cmd+=" $e"
done
full_cmd+=" -v $SOURCE_DIR/.passwd:/etc/passwd:ro"
full_cmd+=" -v $SOURCE_DIR/.group:/etc/group:ro"
full_cmd+=" -u $(id -u):$(id -g)"
full_cmd+=" $DOCKER_REPO/$IMAGE_NAME"
full_cmd+=" bash -c \"$cmd\""
echo "$full_cmd"
echo "--- End docker command ---"
fi
docker run --rm -it --init \
"${VOLUME_MOUNTS[@]}" \
"${CONTAINER_ENV[@]}" \
-v "$SOURCE_DIR/.passwd:/etc/passwd:ro" \
-v "$SOURCE_DIR/.group:/etc/group:ro" \
-u "$(id -u):$(id -g)" \
"$DOCKER_REPO/$IMAGE_NAME" \
bash -c "$cmd"
}
# Run command directly or in container based on DIRECT_BUILD
run_command() {
local cmd="$1"
if [ -n "$DIRECT_BUILD" ] && [ "$DIRECT_BUILD" != "0" ]; then
[ "$DEBUG" = true ] && echo "[DIRECT_BUILD] Executing locally: $cmd"
command -v riscv64-unknown-linux-gnu-gcc > /dev/null || \
(echo "Install cross compile and add to PATH" && exit 1)
export ARCH=riscv
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
bash -c "$cmd"
else
[ "$DEBUG" = true ] && echo "Building in container..."
run_in_container "$cmd"
fi
}
# Execute container actions
case "$ACTION" in
build)
if [[ "$CLEAN" == true ]]; then
run_command "$CLEAN_CMD"
fi
if [[ "$BUILD_DEB" == true ]]; then
run_command "$BUILD_DEB_CMD"
else
run_command "$BUILD_CMD"
fi
echo "Build completed successfully!"
;;
shell)
run_in_container "bash"
echo "Container shell session ended."
;;
*)
echo "Unknown action: $ACTION"
usage
exit 1
;;
esac

View File

@@ -155,7 +155,7 @@ else
fi
sourcename=${KDEB_SOURCENAME:-linux-upstream}
kernelgitver=$(git rev-parse --short HEAD)
kernelgitver=$(git rev-parse --short HEAD) || echo ""
if [ "$ARCH" = "um" ] ; then
packagename=user-mode-linux
@@ -227,7 +227,7 @@ Architecture: $debarch
Description: Linux kernel, version $version
This package contains the Linux kernel, modules and corresponding other
files, version: $version.
Depends: spacemit-flash-dtbs, bianbu-esos (= 0.0.9)
Depends: spacemit-flash-dtbs, bianbu-esos (= 0.0.10)
Provides: linux-image-$baseversion
EOF

View File

@@ -52,6 +52,8 @@
#define BITCLK_DIV_468 (0x0 << 27)
#define FRAME_48K_I2S (0x4 << 15)
#define SYSCLK_PRE_CTRL 0x08
/*
* ssp:sspa audio private data
*/
@@ -299,16 +301,16 @@ static int i2s_sspa_hw_params(struct snd_pcm_substream *substream,
sspa_priv->mclk_fs = sspa_priv->sysclk / (params_rate(params));
switch (sspa_priv->mclk_fs) {
case 64:
target = SYSCLK_BASE_156M | 4 << 15 | 200; //64fs
target = SYSCLK_BASE_156M | 326 << 15 | 32600; //64fs
break;
case 128:
target = SYSCLK_BASE_156M | 8 << 15 | 200; //128fs
target = SYSCLK_BASE_156M | 652 << 15 | 32600; //128fs
break;
case 256:
target = SYSCLK_BASE_156M | 16 << 15 | 200; //256fs
target = SYSCLK_BASE_156M | 1304 << 15 | 32600; //256fs
break;
default:
target = SYSCLK_BASE_156M | 16 << 15 | 200; //256fs
target = SYSCLK_BASE_156M | 1304 << 15 | 32600; //256fs
break;
}
@@ -333,6 +335,10 @@ static int i2s_sspa_hw_params(struct snd_pcm_substream *substream,
val = __raw_readl(sspa->pmumain + ISCCR1);
val = val & ~0x5FFFFFFF;
__raw_writel(val | target, sspa->pmumain + ISCCR1);
val = __raw_readl(sspa->pmumain + SYSCLK_PRE_CTRL);
val |= 1 << 29;
__raw_writel(val, sspa->pmumain + SYSCLK_PRE_CTRL);
return 0;
}
@@ -479,22 +485,26 @@ static void i2s_sspa_init(struct sspa_priv *priv)
switch (priv->mclk_fs) {
case 64:
target = SYSCLK_BASE_156M | 0 << 27| 4 << 15 | 200; //64fs
target = SYSCLK_BASE_156M | 0 << 27 | 326 << 15 | 32600; //64fs
break;
case 128:
target = SYSCLK_BASE_156M | 1 << 27| 8 << 15 | 200; //128fs
target = SYSCLK_BASE_156M | 1 << 27 | 652 << 15 | 32600; //128fs
break;
case 256:
target = SYSCLK_BASE_156M | 3 << 27| 16 << 15 | 200; //256fs
target = SYSCLK_BASE_156M | 3 << 27 | 1304 << 15 | 32600; //256fs
break;
default:
target = SYSCLK_BASE_156M | 3 << 27| 16 << 15 | 200; //256fs
target = SYSCLK_BASE_156M | 3 << 27 | 1304 << 15 | 32600; //256fs
break;
}
val = __raw_readl(sspa->pmumain + ISCCR1);
val = val & ~0x5FFFFFFF;
__raw_writel(val | target, sspa->pmumain + ISCCR1);
val = __raw_readl(sspa->pmumain + SYSCLK_PRE_CTRL);
val |= 1 << 29;
__raw_writel(val, sspa->pmumain + SYSCLK_PRE_CTRL);
}
static int i2s_sspa_suspend(struct device *dev)

View File

@@ -1053,6 +1053,7 @@ static int spacemit_snd_pcm_new(struct snd_soc_component *component, struct snd_
struct snd_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm;
struct snd_pcm_substream *substream;
struct snd_soc_dai_link *dai_link = rtd->dai_link;
pr_debug("%s enter, dev=%s\n", __FUNCTION__, dev_name(rtd->dev));
@@ -1066,12 +1067,18 @@ static int spacemit_snd_pcm_new(struct snd_soc_component *component, struct snd_
pr_err("%s: get dev error\n", __FUNCTION__);
return -1;
}
if (dev->dmadata->dma_id == DMA_HDMI) {
if (dai_link->playback_only) {
chan_num = 1;
pr_debug("%s playback_only, dev=%s\n", __FUNCTION__, dev_name(rtd->dev));
} else if (dai_link->capture_only) {
pr_err("%s not support capture_only, dev=%s\n", __FUNCTION__, dev_name(rtd->dev));
ret = -EINVAL;
return ret;
} else {
chan_num = 2;
}
dev->dmadata[0].stream = SNDRV_PCM_STREAM_PLAYBACK;
dev->dmadata[1].stream = SNDRV_PCM_STREAM_CAPTURE;