linux-6.1.patch 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. diff -rupN old/linux-6.1/arch/arm/mach-zynq/common.c linux-6.1/arch/arm/mach-zynq/common.c
  2. --- old/linux-6.1/arch/arm/mach-zynq/common.c
  3. +++ linux-6.1/arch/arm/mach-zynq/common.c
  4. @@ -96,6 +96,7 @@ static void __init zynq_init_late(void)
  5. {
  6. zynq_core_pm_init();
  7. zynq_pm_late_init();
  8. + zynq_prefetch_init();
  9. }
  10. /**
  11. @@ -187,8 +188,13 @@ static const char * const zynq_dt_match[
  12. DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
  13. /* 64KB way size, 8-way associativity, parity disabled */
  14. +#ifdef CONFIG_XILINX_PREFETCH
  15. + .l2c_aux_val = 0x30400000,
  16. + .l2c_aux_mask = 0xcfbfffff,
  17. +#else
  18. .l2c_aux_val = 0x00400000,
  19. .l2c_aux_mask = 0xffbfffff,
  20. +#endif
  21. .smp = smp_ops(zynq_smp_ops),
  22. .map_io = zynq_map_io,
  23. .init_irq = zynq_irq_init,
  24. diff -rupN old/linux-6.1/arch/arm/mach-zynq/common.h linux-6.1/arch/arm/mach-zynq/common.h
  25. --- old/linux-6.1/arch/arm/mach-zynq/common.h
  26. +++ linux-6.1/arch/arm/mach-zynq/common.h
  27. @@ -29,6 +29,22 @@ extern void __iomem *zynq_scu_base;
  28. void zynq_pm_late_init(void);
  29. +static inline void zynq_prefetch_init(void)
  30. +{
  31. + /*
  32. + * Enable prefetching in aux control register. L2 prefetch must
  33. + * only be enabled if the slave supports it (PL310 does)
  34. + */
  35. + asm volatile ("mrc p15, 0, r1, c1, c0, 1\n"
  36. +#ifdef CONFIG_XILINX_PREFETCH
  37. + "orr r1, r1, #6\n"
  38. +#else
  39. + "bic r1, r1, #6\n"
  40. +#endif
  41. + "mcr p15, 0, r1, c1, c0, 1\n"
  42. + : : : "r1");
  43. +}
  44. +
  45. static inline void zynq_core_pm_init(void)
  46. {
  47. /* A9 clock gating */
  48. diff -rupN old/linux-6.1/arch/arm/mach-zynq/Kconfig linux-6.1/arch/arm/mach-zynq/Kconfig
  49. --- old/linux-6.1/arch/arm/mach-zynq/Kconfig
  50. +++ linux-6.1/arch/arm/mach-zynq/Kconfig
  51. @@ -15,3 +15,19 @@ config ARCH_ZYNQ
  52. select SOC_BUS
  53. help
  54. Support for Xilinx Zynq ARM Cortex A9 Platform
  55. +
  56. +if ARCH_ZYNQ
  57. +
  58. +menu "Xilinx Specific Options"
  59. +
  60. +config XILINX_PREFETCH
  61. + bool "Cache Prefetch"
  62. + default y
  63. + help
  64. + This option turns on L1 & L2 cache prefetching to get the best performance
  65. + in many cases. This may not always be the best performance depending on
  66. + the usage.
  67. +
  68. +endmenu
  69. +
  70. +endif
  71. diff -rupN old/linux-6.1/arch/arm/mach-zynq/platsmp.c linux-6.1/arch/arm/mach-zynq/platsmp.c
  72. --- old/linux-6.1/arch/arm/mach-zynq/platsmp.c
  73. +++ linux-6.1/arch/arm/mach-zynq/platsmp.c
  74. @@ -115,6 +115,7 @@ static void __init zynq_smp_prepare_cpus
  75. static void zynq_secondary_init(unsigned int cpu)
  76. {
  77. zynq_core_pm_init();
  78. + zynq_prefetch_init();
  79. }
  80. #ifdef CONFIG_HOTPLUG_CPU
  81. diff -rupN old/linux-6.1/drivers/char/Kconfig linux-6.1/drivers/char/Kconfig
  82. --- old/linux-6.1/drivers/char/Kconfig
  83. +++ linux-6.1/drivers/char/Kconfig
  84. @@ -459,4 +459,12 @@ config RANDOM_TRUST_BOOTLOADER
  85. believe its RNG facilities may be faulty. This may also be configured
  86. at boot time with "random.trust_bootloader=on/off".
  87. +config DEVCMA
  88. + bool "/dev/cma virtual device support"
  89. + default y
  90. +
  91. +config XILINX_DEVCFG
  92. + tristate "Xilinx Device Configuration"
  93. + depends on ARCH_ZYNQ
  94. +
  95. endmenu
  96. diff -rupN old/linux-6.1/drivers/char/Makefile linux-6.1/drivers/char/Makefile
  97. --- old/linux-6.1/drivers/char/Makefile
  98. +++ linux-6.1/drivers/char/Makefile
  99. @@ -45,3 +45,5 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o
  100. obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/
  101. obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
  102. obj-$(CONFIG_ADI) += adi.o
  103. +obj-$(CONFIG_DEVCMA) += cma.o
  104. +obj-$(CONFIG_XILINX_DEVCFG) += xilinx_devcfg.o
  105. diff -rupN old/linux-6.1/drivers/net/phy/intel-xway.c linux-6.1/drivers/net/phy/intel-xway.c
  106. --- old/linux-6.1/drivers/net/phy/intel-xway.c
  107. +++ linux-6.1/drivers/net/phy/intel-xway.c
  108. @@ -252,6 +252,12 @@ static int xway_gphy_config_init(struct
  109. if (err)
  110. return err;
  111. + /* Set SGMII RX & TX timing skew to 2 ns & 2.5 ns respectively. */
  112. + /* Set MII power supply to 2V5. */
  113. + err = phy_write(phydev, 0x17, 0x4D00);
  114. + if (err)
  115. + return err;
  116. +
  117. phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LEDCH,
  118. XWAY_MMD_LEDCH_NACS_NONE |
  119. XWAY_MMD_LEDCH_SBF_F02HZ |
  120. @@ -261,20 +267,16 @@ static int xway_gphy_config_init(struct
  121. XWAY_MMD_LEDCH_SCAN_NONE);
  122. /**
  123. - * In most cases only one LED is connected to this phy, so
  124. - * configure them all to constant on and pulse mode. LED3 is
  125. - * only available in some packages, leave it in its reset
  126. - * configuration.
  127. + * Set LED0 blinking on RX/TX.
  128. + * Set LED1 blinking on link speed: slow=10M, fast=100M, on=1G.
  129. */
  130. - ledxh = XWAY_MMD_LEDxH_BLINKF_NONE | XWAY_MMD_LEDxH_CON_LINK10XX;
  131. - ledxl = XWAY_MMD_LEDxL_PULSE_TXACT | XWAY_MMD_LEDxL_PULSE_RXACT |
  132. - XWAY_MMD_LEDxL_BLINKS_NONE;
  133. - phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED0H, ledxh);
  134. + ledxl = XWAY_MMD_LEDxL_PULSE_TXACT | XWAY_MMD_LEDxL_PULSE_RXACT;
  135. + phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED0H, 0);
  136. phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED0L, ledxl);
  137. + ledxh = XWAY_MMD_LEDxH_CON_LINK1000 | XWAY_MMD_LEDxH_BLINKF_LINK100;
  138. + ledxl = XWAY_MMD_LEDxH_CON_LINK10;
  139. phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED1H, ledxh);
  140. phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED1L, ledxl);
  141. - phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2H, ledxh);
  142. - phy_write_mmd(phydev, MDIO_MMD_VEND2, XWAY_MMD_LED2L, ledxl);
  143. err = xway_gphy_rgmii_init(phydev);
  144. if (err)
  145. diff -rupN old/linux-6.1/drivers/net/wireless/realtek/Kconfig linux-6.1/drivers/net/wireless/realtek/Kconfig
  146. --- old/linux-6.1/drivers/net/wireless/realtek/Kconfig
  147. +++ linux-6.1/drivers/net/wireless/realtek/Kconfig
  148. @@ -13,9 +13,9 @@ config WLAN_VENDOR_REALTEK
  149. if WLAN_VENDOR_REALTEK
  150. source "drivers/net/wireless/realtek/rtl818x/Kconfig"
  151. -source "drivers/net/wireless/realtek/rtlwifi/Kconfig"
  152. source "drivers/net/wireless/realtek/rtl8xxxu/Kconfig"
  153. source "drivers/net/wireless/realtek/rtw88/Kconfig"
  154. source "drivers/net/wireless/realtek/rtw89/Kconfig"
  155. +source "drivers/net/wireless/realtek/rtl8188eu/Kconfig"
  156. endif # WLAN_VENDOR_REALTEK
  157. diff -rupN old/linux-6.1/drivers/net/wireless/realtek/Makefile linux-6.1/drivers/net/wireless/realtek/Makefile
  158. --- old/linux-6.1/drivers/net/wireless/realtek/Makefile
  159. +++ linux-6.1/drivers/net/wireless/realtek/Makefile
  160. @@ -5,8 +5,8 @@
  161. obj-$(CONFIG_RTL8180) += rtl818x/
  162. obj-$(CONFIG_RTL8187) += rtl818x/
  163. -obj-$(CONFIG_RTLWIFI) += rtlwifi/
  164. obj-$(CONFIG_RTL8XXXU) += rtl8xxxu/
  165. obj-$(CONFIG_RTW88) += rtw88/
  166. obj-$(CONFIG_RTW89) += rtw89/
  167. +obj-$(CONFIG_RTL8188EU) += rtl8188eu/
  168. diff -rupN old/linux-6.1/drivers/pps/clients/pps-gpio.c linux-6.1/drivers/pps/clients/pps-gpio.c
  169. --- old/linux-6.1/drivers/pps/clients/pps-gpio.c
  170. +++ linux-6.1/drivers/pps/clients/pps-gpio.c
  171. @@ -113,6 +113,9 @@ static int pps_gpio_setup(struct device
  172. data->assert_falling_edge =
  173. device_property_read_bool(dev, "assert-falling-edge");
  174. + data->capture_clear =
  175. + device_property_read_bool(dev, "capture-clear");
  176. +
  177. data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW);
  178. if (IS_ERR(data->echo_pin))
  179. return dev_err_probe(dev, PTR_ERR(data->echo_pin),
  180. diff -rupN old/linux-6.1/drivers/usb/chipidea/ci_hdrc_usb2.c linux-6.1/drivers/usb/chipidea/ci_hdrc_usb2.c
  181. --- old/linux-6.1/drivers/usb/chipidea/ci_hdrc_usb2.c
  182. +++ linux-6.1/drivers/usb/chipidea/ci_hdrc_usb2.c
  183. @@ -65,6 +65,10 @@ static int ci_hdrc_usb2_probe(struct pla
  184. if (match && match->data) {
  185. /* struct copy */
  186. *ci_pdata = *(struct ci_hdrc_platform_data *)match->data;
  187. + ci_pdata->usb_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy",
  188. + 0);
  189. + if (IS_ERR(ci_pdata->usb_phy))
  190. + return PTR_ERR(ci_pdata->usb_phy);
  191. }
  192. priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
  193. diff -rupN old/linux-6.1/drivers/usb/chipidea/core.c linux-6.1/drivers/usb/chipidea/core.c
  194. --- old/linux-6.1/drivers/usb/chipidea/core.c
  195. +++ linux-6.1/drivers/usb/chipidea/core.c
  196. @@ -326,7 +326,8 @@ static int _ci_usb_phy_init(struct ci_hd
  197. ret = phy_power_on(ci->phy);
  198. if (ret) {
  199. - phy_exit(ci->phy);
  200. + if (phy_exit(ci->phy) < 0)
  201. + dev_dbg(ci->dev, "phy exit failed\r\n");
  202. return ret;
  203. }
  204. } else {
  205. @@ -343,12 +344,20 @@ static int _ci_usb_phy_init(struct ci_hd
  206. */
  207. static void ci_usb_phy_exit(struct ci_hdrc *ci)
  208. {
  209. + int ret;
  210. +
  211. if (ci->platdata->flags & CI_HDRC_OVERRIDE_PHY_CONTROL)
  212. return;
  213. if (ci->phy) {
  214. - phy_power_off(ci->phy);
  215. - phy_exit(ci->phy);
  216. + ret = phy_power_off(ci->phy);
  217. + if (ret < 0)
  218. + dev_dbg(ci->dev, "phy poweroff failed\r\n");
  219. +
  220. + ret = phy_exit(ci->phy);
  221. + if (ret < 0)
  222. + dev_dbg(ci->dev, "phy exit failed\r\n");
  223. +
  224. } else {
  225. usb_phy_shutdown(ci->usb_phy);
  226. }
  227. @@ -711,13 +720,16 @@ static int ci_get_platdata(struct device
  228. if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
  229. platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
  230. - of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
  231. - &platdata->phy_clkgate_delay_us);
  232. + if (of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
  233. + &platdata->phy_clkgate_delay_us))
  234. + dev_dbg(dev, "Missing phy-clkgate-delay-us property\n");
  235. platdata->itc_setting = 1;
  236. - of_property_read_u32(dev->of_node, "itc-setting",
  237. - &platdata->itc_setting);
  238. + if (of_property_read_u32(dev->of_node, "itc-setting",
  239. + &platdata->itc_setting))
  240. + dev_dbg(dev, "Missing itc-setting property\n");
  241. +
  242. ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
  243. &platdata->ahb_burst_config);
  244. diff -rupN old/linux-6.1/drivers/usb/phy/Kconfig linux-6.1/drivers/usb/phy/Kconfig
  245. --- old/linux-6.1/drivers/usb/phy/Kconfig
  246. +++ linux-6.1/drivers/usb/phy/Kconfig
  247. @@ -174,6 +174,7 @@ config USB_TEGRA_PHY
  248. config USB_ULPI
  249. bool "Generic ULPI Transceiver Driver"
  250. depends on ARM || ARM64 || COMPILE_TEST
  251. + depends on USB_PHY
  252. select USB_ULPI_VIEWPORT
  253. help
  254. Enable this to support ULPI connected USB OTG transceivers which
  255. diff -rupN old/linux-6.1/drivers/usb/phy/phy-ulpi.c linux-6.1/drivers/usb/phy/phy-ulpi.c
  256. --- old/linux-6.1/drivers/usb/phy/phy-ulpi.c
  257. +++ linux-6.1/drivers/usb/phy/phy-ulpi.c
  258. @@ -13,9 +13,16 @@
  259. #include <linux/kernel.h>
  260. #include <linux/slab.h>
  261. #include <linux/export.h>
  262. +#include <linux/module.h>
  263. +#include <linux/of.h>
  264. +#include <linux/io.h>
  265. +#include <linux/of_address.h>
  266. +#include <linux/of_device.h>
  267. +#include <linux/platform_device.h>
  268. #include <linux/usb.h>
  269. #include <linux/usb/otg.h>
  270. #include <linux/usb/ulpi.h>
  271. +#include <linux/usb/phy.h>
  272. struct ulpi_info {
  273. @@ -39,6 +46,13 @@ static struct ulpi_info ulpi_ids[] = {
  274. ULPI_INFO(ULPI_ID(0x0451, 0x1507), "TI TUSB1210"),
  275. };
  276. +struct ulpi_phy {
  277. + struct usb_phy *usb_phy;
  278. + void __iomem *regs;
  279. + unsigned int vp_offset;
  280. + unsigned int flags;
  281. +};
  282. +
  283. static int ulpi_set_otg_flags(struct usb_phy *phy)
  284. {
  285. unsigned int flags = ULPI_OTG_CTRL_DP_PULLDOWN |
  286. @@ -240,6 +254,23 @@ static int ulpi_set_vbus(struct usb_otg
  287. return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL);
  288. }
  289. +static int usbphy_set_vbus(struct usb_phy *phy, int on)
  290. +{
  291. + unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL);
  292. +
  293. + flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT);
  294. +
  295. + if (on) {
  296. + if (phy->flags & ULPI_OTG_DRVVBUS)
  297. + flags |= ULPI_OTG_CTRL_DRVVBUS;
  298. +
  299. + if (phy->flags & ULPI_OTG_DRVVBUS_EXT)
  300. + flags |= ULPI_OTG_CTRL_DRVVBUS_EXT;
  301. + }
  302. +
  303. + return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL);
  304. +}
  305. +
  306. static void otg_ulpi_init(struct usb_phy *phy, struct usb_otg *otg,
  307. struct usb_phy_io_ops *ops,
  308. unsigned int flags)
  309. @@ -249,6 +280,7 @@ static void otg_ulpi_init(struct usb_phy
  310. phy->io_ops = ops;
  311. phy->otg = otg;
  312. phy->init = ulpi_init;
  313. + phy->set_vbus = usbphy_set_vbus;
  314. otg->usb_phy = phy;
  315. otg->set_host = ulpi_set_host;
  316. @@ -301,3 +333,83 @@ devm_otg_ulpi_create(struct device *dev,
  317. return phy;
  318. }
  319. EXPORT_SYMBOL_GPL(devm_otg_ulpi_create);
  320. +
  321. +static int ulpi_phy_probe(struct platform_device *pdev)
  322. +{
  323. + struct device_node *np = pdev->dev.of_node;
  324. + struct resource *res;
  325. + struct ulpi_phy *uphy;
  326. + bool flag;
  327. + int ret;
  328. +
  329. + uphy = devm_kzalloc(&pdev->dev, sizeof(*uphy), GFP_KERNEL);
  330. + if (!uphy)
  331. + return -ENOMEM;
  332. +
  333. + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  334. + if (!res) {
  335. + dev_err(&pdev->dev, "no phy I/O memory resource defined\n");
  336. + return -ENODEV;
  337. + }
  338. +
  339. + uphy->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
  340. + if (!uphy->regs) {
  341. + dev_err(&pdev->dev, "failed to map phy I/O memory\n");
  342. + return -EFAULT;
  343. + }
  344. +
  345. + if (IS_ERR(uphy->regs))
  346. + return PTR_ERR(uphy->regs);
  347. +
  348. + if (of_property_read_u32(np, "view-port", &uphy->vp_offset))
  349. + dev_dbg(&pdev->dev, "Missing view-port property\n");
  350. +
  351. + if (IS_ERR(uphy->regs)) {
  352. + dev_err(&pdev->dev, "view-port register not specified\n");
  353. + return PTR_ERR(uphy->regs);
  354. + }
  355. +
  356. + flag = of_property_read_bool(np, "drv-vbus");
  357. + if (flag)
  358. + uphy->flags |= ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT;
  359. +
  360. + uphy->usb_phy = otg_ulpi_create(&ulpi_viewport_access_ops, uphy->flags);
  361. +
  362. + uphy->usb_phy->dev = &pdev->dev;
  363. +
  364. + uphy->usb_phy->io_priv = uphy->regs + uphy->vp_offset;
  365. +
  366. + ret = usb_add_phy_dev(uphy->usb_phy);
  367. + if (ret < 0)
  368. + return ret;
  369. +
  370. + return 0;
  371. +}
  372. +
  373. +static int ulpi_phy_remove(struct platform_device *pdev)
  374. +{
  375. + struct ulpi_phy *uphy = platform_get_drvdata(pdev);
  376. +
  377. + usb_remove_phy(uphy->usb_phy);
  378. +
  379. + return 0;
  380. +}
  381. +
  382. +static const struct of_device_id ulpi_phy_table[] = {
  383. + { .compatible = "ulpi-phy" },
  384. + { },
  385. +};
  386. +MODULE_DEVICE_TABLE(of, ulpi_phy_table);
  387. +
  388. +static struct platform_driver ulpi_phy_driver = {
  389. + .probe = ulpi_phy_probe,
  390. + .remove = ulpi_phy_remove,
  391. + .driver = {
  392. + .name = "ulpi-phy",
  393. + .of_match_table = ulpi_phy_table,
  394. + },
  395. +};
  396. +module_platform_driver(ulpi_phy_driver);
  397. +
  398. +MODULE_DESCRIPTION("ULPI PHY driver");
  399. +MODULE_LICENSE("GPL v2");