diff --git a/Makefile b/Makefile index 9175706bfe7f..0f2a6c6d0445 100644 --- a/Makefile +++ b/Makefile @@ -399,6 +399,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ -Wno-format-security \ + -Werror \ -std=gnu89 $(call cc-option,-fno-PIE) @@ -447,6 +448,8 @@ PHONY += scripts_basic scripts_basic: $(Q)$(MAKE) $(build)=scripts/basic $(Q)rm -f .tmp_quiet_recordmcount + $(Q)cp $(srctree)/scripts/amlogic/pre-commit $(srctree)/.git/hooks/pre-commit + $(Q)chmod +x $(srctree)/.git/hooks/pre-commit # To avoid any implicit rule to kick in, define an empty command. scripts/basic/%: scripts_basic ; diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 3635b8662724..409d867b1806 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -73,7 +73,7 @@ TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \ int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \ rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}") else -TEXT_OFFSET := 0x00080000 +TEXT_OFFSET := 0x0180000 endif # KASAN_SHADOW_OFFSET = VA_START + (1 << (VA_BITS - 3)) - (1 << 61) @@ -111,7 +111,7 @@ zinstall install: $(Q)$(MAKE) $(build)=$(boot) $@ %.dtb: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ + $(Q)$(MAKE) $(build)=$(boot)/dts/amlogic $(boot)/dts/amlogic/$@ PHONY += dtbs dtbs_install diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile index 47ec703cb230..1d819778d955 100644 --- a/arch/arm64/boot/dts/amlogic/Makefile +++ b/arch/arm64/boot/dts/amlogic/Makefile @@ -1,10 +1,14 @@ -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-odroidc2.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-p200.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-p201.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-pro.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-meta.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-vega-s95-telos.dtb -always := $(dtb-y) -subdir-y := $(dts-dirs) -clean-files := *.dtb +targets += dtbs + +DTB_NAMES := $(subst $\",,$(CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE_NAMES)) +ifneq ($(DTB_NAMES),) +DTB_LIST := $(addsuffix .dtb,$(DTB_NAMES)) +else +DTB_LIST := $(dtb-y) +endif +targets += $(DTB_LIST) + +dtbs: $(addprefix $(obj)/, $(DTB_LIST)) + +clean-files := *.dtb diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts new file mode 100644 index 000000000000..7f937f955fa3 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts @@ -0,0 +1,60 @@ +/* + * arch/arm64/boot/dts/amlogic/gxl_p212_1g.dts + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; + +#include +#include "mesongxl.dtsi" +/ { + model = "Amlogic"; + amlogic-dt-id = "gxl_p212_1g"; + compatible = "amlogic, Gxl"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + serial0 = &uart_AO; + }; + + memory@00000000 { + device_type = "memory"; + linux,usable-memory = <0x0 0x0100000 0x0 0x3ff00000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + /* global autoconfigured region for contiguous allocations */ + secmon_reserved:linux,secmon { + compatible = "amlogic, aml_secmon_memory"; + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + + uart_AO: serial@c81004c0 { + compatible = "amlogic, meson-uart"; + reg = <0x0 0xc81004c0 0x0 0x18>; + interrupts = <0 193 1>; + status = "okay"; + xtal_tick_en = <1>; + fifosize = < 64 >; + support-sysrq = <0>; /* 0 not support , 1 support */ + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts new file mode 100644 index 000000000000..ecdbbaec3962 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts @@ -0,0 +1,60 @@ +/* + * arch/arm64/boot/dts/amlogic/gxl_p212_2g.dts + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; + +#include +#include "mesongxl.dtsi" +/ { + model = "Amlogic"; + amlogic-dt-id = "gxl_p212_2g"; + compatible = "amlogic, Gxl"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + serial0 = &uart_AO; + }; + + memory@00000000 { + device_type = "memory"; + linux,usable-memory = <0x0 0x0100000 0x0 0x7ff00000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + /* global autoconfigured region for contiguous allocations */ + secmon_reserved:linux,secmon { + compatible = "amlogic, aml_secmon_memory"; + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + + uart_AO: serial@c81004c0 { + compatible = "amlogic, meson-uart"; + reg = <0x0 0xc81004c0 0x0 0x18>; + interrupts = <0 193 1>; + status = "okay"; + xtal_tick_en = <1>; + fifosize = < 64 >; + support-sysrq = <0>; /* 0 not support , 1 support */ + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts new file mode 100644 index 000000000000..ffc1c9021c28 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts @@ -0,0 +1,60 @@ +/* + * arch/arm64/boot/dts/amlogic/gxm_q200_2g.dts + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; + +#include +#include "mesongxm.dtsi" +/ { + model = "Amlogic"; + compatible = "amlogic, Gxm"; + amlogic-dt-id = "gxm_q200_2g"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + serial0 = &uart_AO; + }; + + memory@00000000 { + device_type = "memory"; + linux,usable-memory = <0x0 0x0100000 0x0 0x7ff00000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + /* global autoconfigured region for contiguous allocations */ + secmon_reserved:linux,secmon { + compatible = "amlogic, aml_secmon_memory"; + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + + uart_AO: serial@c81004c0 { + compatible = "amlogic, meson-uart"; + reg = <0x0 0xc81004c0 0x0 0x18>; + interrupts = <0 193 1>; + status = "okay"; + xtal_tick_en = <1>; + fifosize = < 64 >; + support-sysrq = <0>; /* 0 not support , 1 support */ + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/gxm_skt.dts b/arch/arm64/boot/dts/amlogic/gxm_skt.dts new file mode 100644 index 000000000000..01fd45a84744 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/gxm_skt.dts @@ -0,0 +1,59 @@ +/* + * arch/arm64/boot/dts/amlogic/gxm_skt.dts + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +/dts-v1/; + +#include +#include "mesongxm.dtsi" +/ { + model = "Amlogic"; + compatible = "amlogic, Gxm"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + aliases { + serial0 = &uart_AO; + }; + + memory@00000000 { + device_type = "memory"; + linux,usable-memory = <0x0 0x1000000 0x0 0x3f000000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + /* global autoconfigured region for contiguous allocations */ + secmon_reserved:linux,secmon { + compatible = "amlogic, aml_secmon_memory"; + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + + uart_AO: serial@c81004c0 { + compatible = "amlogic, meson-uart"; + reg = <0x0 0xc81004c0 0x0 0x18>; + interrupts = <0 193 1>; + status = "okay"; + xtal_tick_en = <1>; + fifosize = < 64 >; + support-sysrq = <0>; /* 0 not support , 1 support */ + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts deleted file mode 100644 index e6e3491d48a5..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * Copyright (c) 2016 BayLibre, Inc. - * Author: Kevin Hilman - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb.dtsi" -#include - -/ { - compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb"; - model = "Hardkernel ODROID-C2"; - - aliases { - serial0 = &uart_AO; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x0 0x0 0x80000000>; - }; - - leds { - compatible = "gpio-leds"; - blue { - label = "c2:blue:alive"; - gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "heartbeat"; - default-state = "off"; - }; - }; -}; - -&uart_AO { - status = "okay"; - pinctrl-0 = <&uart_ao_a_pins>; - pinctrl-names = "default"; -}; - -ðmac { - status = "okay"; - pinctrl-0 = <ð_pins>; - pinctrl-names = "default"; -}; - -&ir { - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -}; - -&i2c_A { - status = "okay"; - pinctrl-0 = <&i2c_a_pins>; - pinctrl-names = "default"; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts deleted file mode 100644 index 03e3d76626dd..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * Copyright (c) 2016 BayLibre, Inc. - * Author: Kevin Hilman - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb-p20x.dtsi" - -/ { - compatible = "amlogic,p200", "amlogic,meson-gxbb"; - model = "Amlogic Meson GXBB P200 Development Board"; -}; - -&i2c_B { - status = "okay"; - pinctrl-0 = <&i2c_b_pins>; - pinctrl-names = "default"; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts deleted file mode 100644 index 39bb037a3e47..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p201.dts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * Copyright (c) 2016 BayLibre, Inc. - * Author: Kevin Hilman - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb-p20x.dtsi" - -/ { - compatible = "amlogic,p201", "amlogic,meson-gxbb"; - model = "Amlogic Meson GXBB P201 Development Board"; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi deleted file mode 100644 index 06a34dc6002f..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * Copyright (c) 2016 BayLibre, Inc. - * Author: Kevin Hilman - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "meson-gxbb.dtsi" - -/ { - aliases { - serial0 = &uart_AO; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x0 0x0 0x40000000>; - }; - - usb_pwr: regulator-usb-pwrs { - compatible = "regulator-fixed"; - - regulator-name = "USB_PWR"; - - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - - /* signal name in schematic: USB_PWR_EN */ - gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; -}; - -/* This UART is brought out to the DB9 connector */ -&uart_AO { - status = "okay"; - pinctrl-0 = <&uart_ao_a_pins>; - pinctrl-names = "default"; -}; - -ðmac { - status = "okay"; - pinctrl-0 = <ð_pins>; - pinctrl-names = "default"; -}; - -&ir { - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -}; - -&usb0_phy { - status = "okay"; - phy-supply = <&usb_pwr>; -}; - -&usb1_phy { - status = "okay"; -}; - -&usb0 { - status = "okay"; -}; - -&usb1 { - status = "okay"; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts deleted file mode 100644 index 62fb4968d680..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-meta.dts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb-vega-s95.dtsi" - -/ { - compatible = "tronsmart,vega-s95-meta", "tronsmart,vega-s95", "amlogic,meson-gxbb"; - model = "Tronsmart Vega S95 Meta"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x0 0x0 0x80000000>; - }; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts deleted file mode 100644 index 9a9663abdf5c..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-pro.dts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb-vega-s95.dtsi" - -/ { - compatible = "tronsmart,vega-s95-pro", "tronsmart,vega-s95", "amlogic,meson-gxbb"; - model = "Tronsmart Vega S95 Pro"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x0 0x0 0x40000000>; - }; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts deleted file mode 100644 index 2fe167b2609d..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95-telos.dts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/dts-v1/; - -#include "meson-gxbb-vega-s95.dtsi" - -/ { - compatible = "tronsmart,vega-s95-telos", "tronsmart,vega-s95", "amlogic,meson-gxbb"; - model = "Tronsmart Vega S95 Telos"; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x0 0x0 0x80000000>; - }; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi deleted file mode 100644 index 73f159370188..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "meson-gxbb.dtsi" - -/ { - compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb"; - - aliases { - serial0 = &uart_AO; - }; - - chosen { - stdout-path = "serial0:115200n8"; - }; - - usb_vbus: regulator-usb0-vbus { - compatible = "regulator-fixed"; - - regulator-name = "USB0_VBUS"; - - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - - gpio = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; - -}; - -&uart_AO { - status = "okay"; - pinctrl-0 = <&uart_ao_a_pins>; - pinctrl-names = "default"; - -}; - -&ir { - status = "okay"; - pinctrl-0 = <&remote_input_ao_pins>; - pinctrl-names = "default"; -}; - -ðmac { - status = "okay"; - pinctrl-0 = <ð_pins>; - pinctrl-names = "default"; -}; - -&usb0_phy { - status = "okay"; - phy-supply = <&usb_vbus>; -}; - -&usb1_phy { - status = "okay"; -}; - -&usb0 { - status = "okay"; -}; - -&usb1 { - status = "okay"; -}; diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi deleted file mode 100644 index 610e0e1c3cee..000000000000 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +++ /dev/null @@ -1,669 +0,0 @@ -/* - * Copyright (c) 2016 Andreas Färber - * - * This file is dual-licensed: you can use it either under the terms - * of the GPL or the X11 license, at your option. Note that this dual - * licensing only applies to this file, and not this project as a - * whole. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Or, alternatively, - * - * b) Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/ { - compatible = "amlogic,meson-gxbb"; - interrupt-parent = <&gic>; - #address-cells = <2>; - #size-cells = <2>; - - cpus { - #address-cells = <0x2>; - #size-cells = <0x0>; - - cpu0: cpu@0 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0x0 0x0>; - enable-method = "psci"; - }; - - cpu1: cpu@1 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0x0 0x1>; - enable-method = "psci"; - }; - - cpu2: cpu@2 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0x0 0x2>; - enable-method = "psci"; - }; - - cpu3: cpu@3 { - device_type = "cpu"; - compatible = "arm,cortex-a53", "arm,armv8"; - reg = <0x0 0x3>; - enable-method = "psci"; - }; - }; - - arm-pmu { - compatible = "arm,cortex-a53-pmu"; - interrupts = , - , - , - ; - interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; - }; - - psci { - compatible = "arm,psci-0.2"; - method = "smc"; - }; - - firmware { - sm: secure-monitor { - compatible = "amlogic,meson-gxbb-sm"; - }; - }; - - efuse: efuse { - compatible = "amlogic,meson-gxbb-efuse"; - #address-cells = <1>; - #size-cells = <1>; - - sn: sn@14 { - reg = <0x14 0x10>; - }; - - eth_mac: eth_mac@34 { - reg = <0x34 0x10>; - }; - - bid: bid@46 { - reg = <0x46 0x30>; - }; - }; - - timer { - compatible = "arm,armv8-timer"; - interrupts = , - , - , - ; - }; - - xtal: xtal-clk { - compatible = "fixed-clock"; - clock-frequency = <24000000>; - clock-output-names = "xtal"; - #clock-cells = <0>; - }; - - soc { - compatible = "simple-bus"; - #address-cells = <2>; - #size-cells = <2>; - ranges; - - usb0_phy: phy@c0000000 { - compatible = "amlogic,meson-gxbb-usb2-phy"; - #phy-cells = <0>; - reg = <0x0 0xc0000000 0x0 0x20>; - resets = <&reset RESET_USB_OTG>; - clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB0>; - clock-names = "usb_general", "usb"; - status = "disabled"; - }; - - usb1_phy: phy@c0000020 { - compatible = "amlogic,meson-gxbb-usb2-phy"; - #phy-cells = <0>; - reg = <0x0 0xc0000020 0x0 0x20>; - clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1>; - clock-names = "usb_general", "usb"; - status = "disabled"; - }; - - cbus: cbus@c1100000 { - compatible = "simple-bus"; - reg = <0x0 0xc1100000 0x0 0x100000>; - #address-cells = <2>; - #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xc1100000 0x0 0x100000>; - - reset: reset-controller@4404 { - compatible = "amlogic,meson-gxbb-reset"; - reg = <0x0 0x04404 0x0 0x20>; - #reset-cells = <1>; - }; - - uart_A: serial@84c0 { - compatible = "amlogic,meson-uart"; - reg = <0x0 0x84c0 0x0 0x14>; - interrupts = ; - clocks = <&xtal>; - status = "disabled"; - }; - - uart_B: serial@84dc { - compatible = "amlogic,meson-uart"; - reg = <0x0 0x84dc 0x0 0x14>; - interrupts = ; - clocks = <&xtal>; - status = "disabled"; - }; - - pwm_ab: pwm@8550 { - compatible = "amlogic,meson-gxbb-pwm"; - reg = <0x0 0x08550 0x0 0x10>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm_cd: pwm@8650 { - compatible = "amlogic,meson-gxbb-pwm"; - reg = <0x0 0x08650 0x0 0x10>; - #pwm-cells = <3>; - status = "disabled"; - }; - - pwm_ef: pwm@86c0 { - compatible = "amlogic,meson-gxbb-pwm"; - reg = <0x0 0x086c0 0x0 0x10>; - #pwm-cells = <3>; - status = "disabled"; - }; - - uart_C: serial@8700 { - compatible = "amlogic,meson-uart"; - reg = <0x0 0x8700 0x0 0x14>; - interrupts = ; - clocks = <&xtal>; - status = "disabled"; - }; - - watchdog@98d0 { - compatible = "amlogic,meson-gxbb-wdt"; - reg = <0x0 0x098d0 0x0 0x10>; - clocks = <&xtal>; - }; - - spifc: spi@8c80 { - compatible = "amlogic,meson-gxbb-spifc"; - reg = <0x0 0x08c80 0x0 0x80>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&clkc CLKID_SPI>; - status = "disabled"; - }; - - i2c_A: i2c@8500 { - compatible = "amlogic,meson-gxbb-i2c"; - reg = <0x0 0x08500 0x0 0x20>; - interrupts = ; - clocks = <&clkc CLKID_I2C>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c_B: i2c@87c0 { - compatible = "amlogic,meson-gxbb-i2c"; - reg = <0x0 0x087c0 0x0 0x20>; - interrupts = ; - clocks = <&clkc CLKID_I2C>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - - i2c_C: i2c@87e0 { - compatible = "amlogic,meson-gxbb-i2c"; - reg = <0x0 0x087e0 0x0 0x20>; - interrupts = ; - clocks = <&clkc CLKID_I2C>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - }; - - gic: interrupt-controller@c4301000 { - compatible = "arm,gic-400"; - reg = <0x0 0xc4301000 0 0x1000>, - <0x0 0xc4302000 0 0x2000>, - <0x0 0xc4304000 0 0x2000>, - <0x0 0xc4306000 0 0x2000>; - interrupt-controller; - interrupts = ; - #interrupt-cells = <3>; - #address-cells = <0>; - }; - - aobus: aobus@c8100000 { - compatible = "simple-bus"; - reg = <0x0 0xc8100000 0x0 0x100000>; - #address-cells = <2>; - #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xc8100000 0x0 0x100000>; - - pinctrl_aobus: pinctrl@14 { - compatible = "amlogic,meson-gxbb-aobus-pinctrl"; - #address-cells = <2>; - #size-cells = <2>; - ranges; - - gpio_ao: bank@14 { - reg = <0x0 0x00014 0x0 0x8>, - <0x0 0x0002c 0x0 0x4>, - <0x0 0x00024 0x0 0x8>; - reg-names = "mux", "pull", "gpio"; - gpio-controller; - #gpio-cells = <2>; - }; - - uart_ao_a_pins: uart_ao_a { - mux { - groups = "uart_tx_ao_a", "uart_rx_ao_a"; - function = "uart_ao"; - }; - }; - - remote_input_ao_pins: remote_input_ao { - mux { - groups = "remote_input_ao"; - function = "remote_input_ao"; - }; - }; - - i2c_ao_pins: i2c_ao { - mux { - groups = "i2c_sck_ao", - "i2c_sda_ao"; - function = "i2c_ao"; - }; - }; - - pwm_ao_a_3_pins: pwm_ao_a_3 { - mux { - groups = "pwm_ao_a_3"; - function = "pwm_ao_a_3"; - }; - }; - - pwm_ao_a_6_pins: pwm_ao_a_6 { - mux { - groups = "pwm_ao_a_6"; - function = "pwm_ao_a_6"; - }; - }; - - pwm_ao_a_12_pins: pwm_ao_a_12 { - mux { - groups = "pwm_ao_a_12"; - function = "pwm_ao_a_12"; - }; - }; - - pwm_ao_b_pins: pwm_ao_b { - mux { - groups = "pwm_ao_b"; - function = "pwm_ao_b"; - }; - }; - }; - - clkc_AO: clock-controller@040 { - compatible = "amlogic,gxbb-aoclkc"; - reg = <0x0 0x00040 0x0 0x4>; - #clock-cells = <1>; - #reset-cells = <1>; - }; - - uart_AO: serial@4c0 { - compatible = "amlogic,meson-uart"; - reg = <0x0 0x004c0 0x0 0x14>; - interrupts = ; - clocks = <&xtal>; - status = "disabled"; - }; - - ir: ir@580 { - compatible = "amlogic,meson-gxbb-ir"; - reg = <0x0 0x00580 0x0 0x40>; - interrupts = ; - status = "disabled"; - }; - - pwm_ab_AO: pwm@550 { - compatible = "amlogic,meson-gxbb-pwm"; - reg = <0x0 0x0550 0x0 0x10>; - #pwm-cells = <3>; - status = "disabled"; - }; - - i2c_AO: i2c@500 { - compatible = "amlogic,meson-gxbb-i2c"; - reg = <0x0 0x500 0x0 0x20>; - interrupts = ; - clocks = <&clkc CLKID_AO_I2C>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - }; - - periphs: periphs@c8834000 { - compatible = "simple-bus"; - reg = <0x0 0xc8834000 0x0 0x2000>; - #address-cells = <2>; - #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xc8834000 0x0 0x2000>; - - rng { - compatible = "amlogic,meson-rng"; - reg = <0x0 0x0 0x0 0x4>; - }; - - pinctrl_periphs: pinctrl@4b0 { - compatible = "amlogic,meson-gxbb-periphs-pinctrl"; - #address-cells = <2>; - #size-cells = <2>; - ranges; - - gpio: bank@4b0 { - reg = <0x0 0x004b0 0x0 0x28>, - <0x0 0x004e8 0x0 0x14>, - <0x0 0x00120 0x0 0x14>, - <0x0 0x00430 0x0 0x40>; - reg-names = "mux", "pull", "pull-enable", "gpio"; - gpio-controller; - #gpio-cells = <2>; - }; - - emmc_pins: emmc { - mux { - groups = "emmc_nand_d07", - "emmc_cmd", - "emmc_clk"; - function = "emmc"; - }; - }; - - nor_pins: nor { - mux { - groups = "nor_d", - "nor_q", - "nor_c", - "nor_cs"; - function = "nor"; - }; - }; - - sdcard_pins: sdcard { - mux { - groups = "sdcard_d0", - "sdcard_d1", - "sdcard_d2", - "sdcard_d3", - "sdcard_cmd", - "sdcard_clk"; - function = "sdcard"; - }; - }; - - sdio_pins: sdio { - mux { - groups = "sdio_d0", - "sdio_d1", - "sdio_d2", - "sdio_d3", - "sdio_cmd", - "sdio_clk"; - function = "sdio"; - }; - }; - - sdio_irq_pins: sdio_irq { - mux { - groups = "sdio_irq"; - function = "sdio"; - }; - }; - - uart_a_pins: uart_a { - mux { - groups = "uart_tx_a", - "uart_rx_a"; - function = "uart_a"; - }; - }; - - uart_b_pins: uart_b { - mux { - groups = "uart_tx_b", - "uart_rx_b"; - function = "uart_b"; - }; - }; - - uart_c_pins: uart_c { - mux { - groups = "uart_tx_c", - "uart_rx_c"; - function = "uart_c"; - }; - }; - - i2c_a_pins: i2c_a { - mux { - groups = "i2c_sck_a", - "i2c_sda_a"; - function = "i2c_a"; - }; - }; - - i2c_b_pins: i2c_b { - mux { - groups = "i2c_sck_b", - "i2c_sda_b"; - function = "i2c_b"; - }; - }; - - i2c_c_pins: i2c_c { - mux { - groups = "i2c_sck_c", - "i2c_sda_c"; - function = "i2c_c"; - }; - }; - - eth_pins: eth_c { - mux { - groups = "eth_mdio", - "eth_mdc", - "eth_clk_rx_clk", - "eth_rx_dv", - "eth_rxd0", - "eth_rxd1", - "eth_rxd2", - "eth_rxd3", - "eth_rgmii_tx_clk", - "eth_tx_en", - "eth_txd0", - "eth_txd1", - "eth_txd2", - "eth_txd3"; - function = "eth"; - }; - }; - - pwm_a_x_pins: pwm_a_x { - mux { - groups = "pwm_a_x"; - function = "pwm_a_x"; - }; - }; - - pwm_a_y_pins: pwm_a_y { - mux { - groups = "pwm_a_y"; - function = "pwm_a_y"; - }; - }; - - pwm_b_pins: pwm_b { - mux { - groups = "pwm_b"; - function = "pwm_b"; - }; - }; - - pwm_d_pins: pwm_d { - mux { - groups = "pwm_d"; - function = "pwm_d"; - }; - }; - - pwm_e_pins: pwm_e { - mux { - groups = "pwm_e"; - function = "pwm_e"; - }; - }; - - pwm_f_x_pins: pwm_f_x { - mux { - groups = "pwm_f_x"; - function = "pwm_f_x"; - }; - }; - - pwm_f_y_pins: pwm_f_y { - mux { - groups = "pwm_f_y"; - function = "pwm_f_y"; - }; - }; - }; - }; - - hiubus: hiubus@c883c000 { - compatible = "simple-bus"; - reg = <0x0 0xc883c000 0x0 0x2000>; - #address-cells = <2>; - #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xc883c000 0x0 0x2000>; - - clkc: clock-controller@0 { - compatible = "amlogic,gxbb-clkc"; - #clock-cells = <1>; - reg = <0x0 0x0 0x0 0x3db>; - }; - - mailbox: mailbox@404 { - compatible = "amlogic,meson-gxbb-mhu"; - reg = <0 0x404 0 0x4c>; - interrupts = <0 208 IRQ_TYPE_EDGE_RISING>, - <0 209 IRQ_TYPE_EDGE_RISING>, - <0 210 IRQ_TYPE_EDGE_RISING>; - #mbox-cells = <1>; - }; - }; - - apb: apb@d0000000 { - compatible = "simple-bus"; - reg = <0x0 0xd0000000 0x0 0x200000>; - #address-cells = <2>; - #size-cells = <2>; - ranges = <0x0 0x0 0x0 0xd0000000 0x0 0x200000>; - }; - - usb0: usb@c9000000 { - compatible = "amlogic,meson-gxbb-usb", "snps,dwc2"; - reg = <0x0 0xc9000000 0x0 0x40000>; - interrupts = ; - clocks = <&clkc CLKID_USB0_DDR_BRIDGE>; - clock-names = "otg"; - phys = <&usb0_phy>; - phy-names = "usb2-phy"; - dr_mode = "host"; - status = "disabled"; - }; - - usb1: usb@c9100000 { - compatible = "amlogic,meson-gxbb-usb", "snps,dwc2"; - reg = <0x0 0xc9100000 0x0 0x40000>; - interrupts = ; - clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; - clock-names = "otg"; - phys = <&usb1_phy>; - phy-names = "usb2-phy"; - dr_mode = "host"; - status = "disabled"; - }; - - ethmac: ethernet@c9410000 { - compatible = "amlogic,meson-gxbb-dwmac", "snps,dwmac"; - reg = <0x0 0xc9410000 0x0 0x10000 - 0x0 0xc8834540 0x0 0x4>; - interrupts = <0 8 1>; - interrupt-names = "macirq"; - clocks = <&clkc CLKID_ETH>, - <&clkc CLKID_FCLK_DIV2>, - <&clkc CLKID_MPLL2>; - clock-names = "stmmaceth", "clkin0", "clkin1"; - phy-mode = "rgmii"; - status = "disabled"; - }; - }; -}; diff --git a/arch/arm64/boot/dts/amlogic/mesongxl.dtsi b/arch/arm64/boot/dts/amlogic/mesongxl.dtsi new file mode 100644 index 000000000000..facfe9b98a71 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/mesongxl.dtsi @@ -0,0 +1,167 @@ +/* + * arch/arm64/boot/dts/amlogic/mesongxl.dtsi + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#include +/ { + cpus:cpus { + #address-cells = <2>; + #size-cells = <0>; + + cpu-map { + cluster0:cluster0 { + #cooling-cells = <2>; /* min followed by max */ + core0 { + cpu = <&CPU0>; + }; + core1 { + cpu = <&CPU1>; + }; + core2 { + cpu = <&CPU2>; + }; + core3 { + cpu = <&CPU3>; + }; + }; + }; + CPU0:cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x0>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU1:cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x1>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + CPU2:cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x2>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU3:cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x3>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + + idle-states { + entry-method = "arm,psci"; + + CPU_SLEEP_0: cpu-sleep-0 { + compatible = "arm, idle-state"; + arm,psci-suspend-param = <0x0010000>; + local-timer-stop; + entry-latency-us = <3000>; + exit-latency-us = <3000>; + min-residency-us = <8000>; + }; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm, idle-state"; + arm,psci-suspend-param = <0x1010000>; + local-timer-stop; + entry-latency-us = <3000>; + exit-latency-us = <3000>; + min-residency-us = <15000>; + }; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = , + , + , + ; + }; + timer_bc { + compatible = "arm, meson-bc-timer"; + reg= <0x0 0xc1109990 0x0 0x4 0x0 0xc1109994 0x0 0x4>; + timer_name = "Meson TimerF"; + clockevent-rating=<300>; + clockevent-shift=<20>; + clockevent-features=<0x23>; + interrupts = <0 60 1>; + bit_enable=<16>; + bit_mode=<12>; + bit_resolution=<0>; + }; + arm_pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = <0 137 4>, + <0 138 4>, + <0 153 4>, + <0 154 4>; + }; + + gic: interrupt-controller@2c001000 { + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + reg = <0x0 0xc4301000 0 0x1000>, + <0x0 0xc4302000 0 0x0100>; + interrupts = ; + }; + + + psci { + compatible = "arm,psci"; + method = "smc"; + cpu_suspend = <0xC4000001>; + cpu_off = <0x84000002>; + cpu_on = <0xC4000003>; + migrate = <0xC4000005>; + }; + secmon { + compatible = "amlogic, secmon"; + memory-region = <&secmon_reserved>; + in_base_func = <0x82000020>; + out_base_func = <0x82000021>; + }; + cpu_iomap{ + compatible = "amlogic, iomap"; + #address-cells=<2>; + #size-cells=<2>; + ranges; + io_cbus_base{ + reg = <0x0 0xc1100000 0x0 0x100000>; + }; + io_apb_base{ + reg = <0x0 0xd0000000 0x0 0x200000>; + }; + io_aobus_base{ + reg = <0x0 0xc8100000 0x0 0x100000>; + }; + }; + + cpu_version{ + reg=<0x0 0xc8100220 0x0 0x4>; + }; +};/* end of / */ diff --git a/arch/arm64/boot/dts/amlogic/mesongxm.dtsi b/arch/arm64/boot/dts/amlogic/mesongxm.dtsi new file mode 100644 index 000000000000..1c38e02fd2cd --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/mesongxm.dtsi @@ -0,0 +1,212 @@ +/* + * arch/arm64/boot/dts/amlogic/mesongxm.dtsi + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#include +/ { + cpus:cpus { + #address-cells = <2>; + #size-cells = <0>; + + cpu-map { + cluster0:cluster0 { + #cooling-cells = <2>; /* min followed by max */ + core0 { + cpu = <&CPU0>; + }; + core1 { + cpu = <&CPU1>; + }; + core2 { + cpu = <&CPU2>; + }; + core3 { + cpu = <&CPU3>; + }; + }; + cluster1:cluster1 { + #cooling-cells = <2>; /* min followed by max */ + core0 { + cpu = <&CPU4>; + }; + core1 { + cpu = <&CPU5>; + }; + core2 { + cpu = <&CPU6>; + }; + core3 { + cpu = <&CPU7>; + }; + }; + }; + CPU0:cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x0>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU1:cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x1>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + CPU2:cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x2>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU3:cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x3>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU4:cpu@100 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x100>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU5:cpu@101 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x101>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + CPU6:cpu@102 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x102>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + CPU7:cpu@103 { + device_type = "cpu"; + compatible = "arm,cortex-a53","arm,armv8"; + reg = <0x0 0x103>; + enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0 &CLUSTER_SLEEP_0>; + }; + + idle-states { + entry-method = "arm,psci"; + + CPU_SLEEP_0: cpu-sleep-0 { + compatible = "arm, idle-state"; + arm,psci-suspend-param = <0x0010000>; + local-timer-stop; + entry-latency-us = <3000>; + exit-latency-us = <3000>; + min-residency-us = <8000>; + }; + + CLUSTER_SLEEP_0: cluster-sleep-0 { + compatible = "arm, idle-state"; + arm,psci-suspend-param = <0x1010000>; + local-timer-stop; + entry-latency-us = <3000>; + exit-latency-us = <3000>; + min-residency-us = <15000>; + }; + }; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = , + , + , + ; + }; + timer_bc { + compatible = "arm, meson-bc-timer"; + reg= <0x0 0xc1109990 0x0 0x4 0x0 0xc1109994 0x0 0x4>; + timer_name = "Meson TimerF"; + clockevent-rating=<300>; + clockevent-shift=<20>; + clockevent-features=<0x23>; + interrupts = <0 60 1>; + bit_enable=<16>; + bit_mode=<12>; + bit_resolution=<0>; + }; + arm_pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = <0 137 4>, + <0 138 4>, + <0 153 4>, + <0 154 4>; + }; + + gic: interrupt-controller@2c001000 { + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + reg = <0x0 0xc4301000 0 0x1000>, + <0x0 0xc4302000 0 0x0100>; + interrupts = ; + }; + + + psci { + compatible = "arm,psci"; + method = "smc"; + cpu_suspend = <0xC4000001>; + cpu_off = <0x84000002>; + cpu_on = <0xC4000003>; + migrate = <0xC4000005>; + }; + secmon { + compatible = "amlogic, secmon"; + memory-region = <&secmon_reserved>; + in_base_func = <0x82000020>; + out_base_func = <0x82000021>; + }; + cpu_iomap{ + compatible = "amlogic, iomap"; + #address-cells=<2>; + #size-cells=<2>; + ranges; + io_cbus_base{ + reg = <0x0 0xc1100000 0x0 0x100000>; + }; + io_apb_base{ + reg = <0x0 0xd0000000 0x0 0x200000>; + }; + io_aobus_base{ + reg = <0x0 0xc8100000 0x0 0x100000>; + }; + }; + + cpu_version{ + reg=<0x0 0xc8100220 0x0 0x4>; + }; +};/* end of / */ diff --git a/arch/arm64/configs/meson64_defconfig b/arch/arm64/configs/meson64_defconfig new file mode 100644 index 000000000000..e776d299fcd3 --- /dev/null +++ b/arch/arm64/configs/meson64_defconfig @@ -0,0 +1,307 @@ +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_AUDIT=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_IKCONFIG=y +CONFIG_LOG_BUF_SHIFT=19 +CONFIG_CGROUPS=y +CONFIG_CGROUP_SCHED=y +CONFIG_RT_GROUP_SCHED=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_CGROUP_DEBUG=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EMBEDDED=y +# CONFIG_COMPAT_BRK is not set +CONFIG_PROFILING=y +CONFIG_JUMP_LABEL=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_SCHED_MC=y +CONFIG_NR_CPUS=8 +CONFIG_PREEMPT=y +CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 +CONFIG_CMA=y +CONFIG_ZSMALLOC=y +CONFIG_SECCOMP=y +CONFIG_BINFMT_MISC=y +CONFIG_COMPAT=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_FREQ=y +CONFIG_ARM_BIG_LITTLE_CPUFREQ=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_PACKET_DIAG=y +CONFIG_UNIX=y +CONFIG_UNIX_DIAG=y +CONFIG_XFRM_USER=y +CONFIG_NET_KEY=y +CONFIG_NET_KEY_MIGRATE=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=y +CONFIG_SYN_COOKIES=y +CONFIG_INET_ESP=y +CONFIG_IPV6_ROUTER_PREF=y +CONFIG_IPV6_ROUTE_INFO=y +CONFIG_IPV6_OPTIMISTIC_DAD=y +CONFIG_INET6_AH=y +CONFIG_INET6_ESP=y +CONFIG_INET6_IPCOMP=y +CONFIG_IPV6_MIP6=y +CONFIG_IPV6_TUNNEL=y +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_NETFILTER=y +CONFIG_NF_CONNTRACK=y +CONFIG_NF_CONNTRACK_EVENTS=y +CONFIG_NF_CT_PROTO_DCCP=y +CONFIG_NF_CT_PROTO_SCTP=y +CONFIG_NF_CT_PROTO_UDPLITE=y +CONFIG_NF_CONNTRACK_AMANDA=y +CONFIG_NF_CONNTRACK_FTP=y +CONFIG_NF_CONNTRACK_H323=y +CONFIG_NF_CONNTRACK_IRC=y +CONFIG_NF_CONNTRACK_NETBIOS_NS=y +CONFIG_NF_CONNTRACK_PPTP=y +CONFIG_NF_CONNTRACK_SANE=y +CONFIG_NF_CONNTRACK_TFTP=y +CONFIG_NF_CT_NETLINK=y +CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y +CONFIG_NETFILTER_XT_TARGET_CONNMARK=y +CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y +CONFIG_NETFILTER_XT_TARGET_MARK=y +CONFIG_NETFILTER_XT_TARGET_NFLOG=y +CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y +CONFIG_NETFILTER_XT_TARGET_TPROXY=y +CONFIG_NETFILTER_XT_TARGET_TRACE=y +CONFIG_NETFILTER_XT_MATCH_COMMENT=y +CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y +CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y +CONFIG_NETFILTER_XT_MATCH_CONNMARK=y +CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y +CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=y +CONFIG_NETFILTER_XT_MATCH_HELPER=y +CONFIG_NETFILTER_XT_MATCH_IPRANGE=y +CONFIG_NETFILTER_XT_MATCH_LENGTH=y +CONFIG_NETFILTER_XT_MATCH_LIMIT=y +CONFIG_NETFILTER_XT_MATCH_MAC=y +CONFIG_NETFILTER_XT_MATCH_MARK=y +CONFIG_NETFILTER_XT_MATCH_POLICY=y +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y +CONFIG_NETFILTER_XT_MATCH_QUOTA=y +CONFIG_NETFILTER_XT_MATCH_SOCKET=y +CONFIG_NETFILTER_XT_MATCH_STATE=y +CONFIG_NETFILTER_XT_MATCH_STATISTIC=y +CONFIG_NETFILTER_XT_MATCH_STRING=y +CONFIG_NETFILTER_XT_MATCH_TIME=y +CONFIG_NETFILTER_XT_MATCH_U32=y +CONFIG_NF_CONNTRACK_IPV4=y +CONFIG_NF_NAT_IPV4=y +CONFIG_IP_NF_IPTABLES=y +CONFIG_IP_NF_MATCH_AH=y +CONFIG_IP_NF_MATCH_ECN=y +CONFIG_IP_NF_MATCH_TTL=y +CONFIG_IP_NF_FILTER=y +CONFIG_IP_NF_TARGET_REJECT=y +CONFIG_IP_NF_MANGLE=y +CONFIG_IP_NF_RAW=y +CONFIG_IP_NF_ARPTABLES=y +CONFIG_IP_NF_ARPFILTER=y +CONFIG_IP_NF_ARP_MANGLE=y +CONFIG_NF_CONNTRACK_IPV6=y +CONFIG_NF_NAT_IPV6=y +CONFIG_IP6_NF_IPTABLES=y +CONFIG_IP6_NF_FILTER=y +CONFIG_IP6_NF_TARGET_REJECT=y +CONFIG_IP6_NF_MANGLE=y +CONFIG_IP6_NF_RAW=y +CONFIG_L2TP=y +CONFIG_L2TP_DEBUGFS=y +CONFIG_L2TP_V3=y +CONFIG_L2TP_IP=y +CONFIG_L2TP_ETH=y +CONFIG_BRIDGE=y +# CONFIG_BRIDGE_IGMP_SNOOPING is not set +CONFIG_PHONET=y +CONFIG_NET_SCHED=y +CONFIG_NET_SCH_HTB=y +CONFIG_NET_SCH_INGRESS=y +CONFIG_NET_CLS_U32=y +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_U32=y +CONFIG_NET_CLS_ACT=y +CONFIG_NET_ACT_POLICE=y +CONFIG_NET_ACT_GACT=y +CONFIG_NET_ACT_MIRRED=y +CONFIG_BT=y +CONFIG_BT_RFCOMM=y +CONFIG_BT_RFCOMM_TTY=y +CONFIG_BT_BNEP=y +CONFIG_BT_BNEP_MC_FILTER=y +CONFIG_BT_BNEP_PROTO_FILTER=y +CONFIG_BT_HIDP=y +CONFIG_BT_HCIUART=y +CONFIG_BT_HCIUART_H4=y +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_RFKILL=y +CONFIG_AMLOGIC_DRIVER=y +CONFIG_AMLOGIC_UART=y +CONFIG_AMLOGIC_SERIAL_MESON_CONSOLE=y +CONFIG_AMLOGIC_IOMAP=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DMA_CMA=y +CONFIG_CONNECTOR=y +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_OOPS=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_INTELEXT=y +CONFIG_MTD_NAND=y +CONFIG_ZRAM=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_VIRTIO_BLK=y +CONFIG_EEPROM_AT24=y +CONFIG_SCSI=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_MD=y +CONFIG_BLK_DEV_DM=y +CONFIG_DM_CRYPT=y +CONFIG_DM_VERITY=y +CONFIG_NETDEVICES=y +CONFIG_TUN=y +CONFIG_STMMAC_ETH=y +CONFIG_ICPLUS_PHY=y +CONFIG_REALTEK_PHY=y +CONFIG_PPP=y +CONFIG_PPP_BSDCOMP=y +CONFIG_PPP_DEFLATE=y +CONFIG_PPP_FILTER=y +CONFIG_PPP_MPPE=y +CONFIG_PPP_MULTILINK=y +CONFIG_PPPOE=y +CONFIG_PPPOL2TP=y +CONFIG_PPP_ASYNC=y +CONFIG_USB_USBNET=y +CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_JOYSTICK=y +CONFIG_JOYSTICK_XPAD=y +CONFIG_JOYSTICK_XPAD_FF=y +CONFIG_JOYSTICK_XPAD_LEDS=y +CONFIG_INPUT_MISC=y +CONFIG_INPUT_UINPUT=y +# CONFIG_DEVMEM is not set +# CONFIG_DEVKMEM is not set +CONFIG_HW_RANDOM=y +CONFIG_THERMAL=y +CONFIG_THERMAL_WRITABLE_TRIPS=y +CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y +CONFIG_THERMAL_GOV_USER_SPACE=y +CONFIG_CPU_THERMAL=y +CONFIG_DEVFREQ_THERMAL=y +CONFIG_REGULATOR=y +CONFIG_MEDIA_SUPPORT=y +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_USB_VIDEO_CLASS=y +CONFIG_UHID=y +CONFIG_USB_HIDDEV=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_ACM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_HOST=y +CONFIG_USB_SERIAL=y +CONFIG_USB_ISP1301=y +CONFIG_USB_GADGET=y +CONFIG_USB_CONFIGFS=y +CONFIG_USB_CONFIGFS_F_FS=y +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y +CONFIG_LEDS_TRIGGER_BACKLIGHT=y +CONFIG_UIO=y +CONFIG_UIO_PDRV_GENIRQ=y +CONFIG_VIRTIO_MMIO=y +CONFIG_PM_DEVFREQ=y +CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y +CONFIG_DEVFREQ_GOV_PERFORMANCE=y +CONFIG_DEVFREQ_GOV_POWERSAVE=y +CONFIG_DEVFREQ_GOV_USERSPACE=y +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +CONFIG_EXT3_FS_POSIX_ACL=y +CONFIG_EXT3_FS_SECURITY=y +CONFIG_FANOTIFY=y +CONFIG_QUOTA=y +CONFIG_QFMT_V2=y +CONFIG_AUTOFS4_FS=y +CONFIG_FUSE_FS=y +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_ECRYPT_FS=y +CONFIG_JFFS2_FS=y +CONFIG_JFFS2_SUMMARY=y +CONFIG_JFFS2_FS_XATTR=y +CONFIG_JFFS2_COMPRESSION_OPTIONS=y +CONFIG_JFFS2_LZO=y +CONFIG_JFFS2_RUBIN=y +CONFIG_CRAMFS=y +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_RAM=y +CONFIG_NFS_FS=y +# CONFIG_NFS_V2 is not set +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_PRINTK_TIME=y +CONFIG_DEBUG_INFO=y +CONFIG_SCHEDSTATS=y +CONFIG_TIMER_STATS=y +CONFIG_FTRACE_SYSCALLS=y +CONFIG_STACK_TRACER=y +CONFIG_FUNCTION_PROFILER=y +CONFIG_KGDB=y +CONFIG_KGDB_TESTS=y +CONFIG_SECURITY=y +CONFIG_SECURITYFS=y +CONFIG_SECURITY_PATH=y +CONFIG_LSM_MMAP_MIN_ADDR=0 +CONFIG_SECURITY_SELINUX=y +CONFIG_SECURITY_SMACK=y +CONFIG_CRYPTO_CRYPTD=y +CONFIG_CRYPTO_MICHAEL_MIC=y +CONFIG_CRYPTO_TWOFISH=y +CONFIG_CRYPTO_ANSI_CPRNG=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_CRYPTO_USER_API_SKCIPHER=y +CONFIG_CRC_T10DIF=y +CONFIG_CRC7=y diff --git a/drivers/Kconfig b/drivers/Kconfig index e1e2066cecdb..6a356dd7eb27 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -1,5 +1,7 @@ menu "Device Drivers" +source "drivers/amlogic/Kconfig" + source "drivers/amba/Kconfig" source "drivers/base/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 194d20bee7dc..445773394890 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -173,3 +173,4 @@ obj-$(CONFIG_STM) += hwtracing/stm/ obj-$(CONFIG_ANDROID) += android/ obj-$(CONFIG_NVMEM) += nvmem/ obj-$(CONFIG_FPGA) += fpga/ +obj-$(CONFIG_AMLOGIC_DRIVER) += amlogic/ diff --git a/drivers/amlogic/Kconfig b/drivers/amlogic/Kconfig new file mode 100644 index 000000000000..3aab4346d106 --- /dev/null +++ b/drivers/amlogic/Kconfig @@ -0,0 +1,19 @@ +# +# Amlogic driver configuration +# +config AMLOGIC_DRIVER + bool "Amlogic Peripheral drivers" + default n + help + this option is provided for control amlogic + drivers, if you want to use amlogic driver + please open it +if AMLOGIC_DRIVER +menu "Amlogic Device Drivers" + +source "drivers/amlogic/uart/Kconfig" + +source "drivers/amlogic/iomap/Kconfig" + +endmenu +endif diff --git a/drivers/amlogic/Makefile b/drivers/amlogic/Makefile new file mode 100644 index 000000000000..fa7f49b5122f --- /dev/null +++ b/drivers/amlogic/Makefile @@ -0,0 +1,13 @@ +########################################## +########## Amlogic Drivers ############### +########################################## + +########################################## +## The order of directories matter. +## Do not change. +########################################## + + +obj-$(CONFIG_AMLOGIC_UART) += uart/ + +obj-$(CONFIG_AMLOGIC_IOMAP) += iomap/ diff --git a/drivers/amlogic/iomap/Kconfig b/drivers/amlogic/iomap/Kconfig new file mode 100644 index 000000000000..2e3acd155775 --- /dev/null +++ b/drivers/amlogic/iomap/Kconfig @@ -0,0 +1,7 @@ +# Amlogic iomap driver +# +config AMLOGIC_IOMAP + bool "Amlogic iomap support" + select REGMAP_MMIO + help + This is the Amlogic Iomap driver diff --git a/drivers/amlogic/iomap/Makefile b/drivers/amlogic/iomap/Makefile new file mode 100644 index 000000000000..a12a73db172c --- /dev/null +++ b/drivers/amlogic/iomap/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_AMLOGIC_IOMAP) +=iomap.o diff --git a/drivers/amlogic/iomap/iomap.c b/drivers/amlogic/iomap/iomap.c new file mode 100644 index 000000000000..d39f69c9bdf8 --- /dev/null +++ b/drivers/amlogic/iomap/iomap.c @@ -0,0 +1,270 @@ +/* + * drivers/amlogic/iomap/iomap.c + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef pr_fmt +#define pr_fmt(fmt) "aml_iomap: " fmt + + +static const struct of_device_id iomap_dt_match[] = { + { .compatible = "amlogic, iomap" }, + { /* sentinel */ }, +}; +void __iomem *meson_reg_map[IO_BUS_MAX]; + +int aml_reg_read(u32 bus_type, unsigned int reg, unsigned int *val) +{ + if ((bus_type >= IO_CBUS_BASE) && (bus_type < IO_BUS_MAX)) { + *val = readl((meson_reg_map[bus_type]+reg)); + return 0; + } else + return -1; +} +EXPORT_SYMBOL(aml_reg_read); + +int aml_reg_write(u32 bus_type, unsigned int reg, unsigned int val) +{ + if ((bus_type >= IO_CBUS_BASE) && (bus_type < IO_BUS_MAX)) { + writel(val, (meson_reg_map[bus_type]+reg)); + return 0; + } else + return -1; +} +EXPORT_SYMBOL(aml_reg_write); + +int aml_regmap_update_bits(u32 bus_type, + unsigned int reg, unsigned int mask, + unsigned int val) +{ + if ((bus_type >= IO_CBUS_BASE) && (bus_type < IO_BUS_MAX)) { + unsigned int tmp, orig; + + aml_reg_read(bus_type, reg, &orig); + tmp = orig & ~mask; + tmp |= val & mask; + aml_reg_write(bus_type, reg, tmp); + return 0; + } else + return -1; +} +EXPORT_SYMBOL(aml_regmap_update_bits); + +/* + * CBUS REG Read Write and Update some bits + */ +int aml_read_cbus(unsigned int reg) +{ + int ret, val; + + ret = aml_reg_read(IO_CBUS_BASE, reg<<2, &val); + if (ret) { + pr_err("read cbus reg %x error %d\n", reg, ret); + return -1; + } else + return val; +} +EXPORT_SYMBOL(aml_read_cbus); + +void aml_write_cbus(unsigned int reg, unsigned int val) +{ + int ret; + + ret = aml_reg_write(IO_CBUS_BASE, reg<<2, val); + if (ret) + pr_err("write cbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_write_cbus); + +void aml_cbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val) +{ + int ret; + + ret = aml_regmap_update_bits(IO_CBUS_BASE, reg<<2, mask, val); + if (ret) + pr_err("write cbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_cbus_update_bits); + +/* + * AO REG Read Write and Update some bits + */ +int aml_read_aobus(unsigned int reg) +{ + int ret, val; + + ret = aml_reg_read(IO_AOBUS_BASE, reg, &val); + if (ret) { + pr_err("read ao bus reg %x error %d\n", reg, ret); + return -1; + } else + return val; +} +EXPORT_SYMBOL(aml_read_aobus); + +void aml_write_aobus(unsigned int reg, unsigned int val) +{ + int ret; + + ret = aml_reg_write(IO_AOBUS_BASE, reg, val); + if (ret) + pr_err("write ao bus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_write_aobus); + +void aml_aobus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val) +{ + int ret; + + ret = aml_regmap_update_bits(IO_AOBUS_BASE, reg, mask, val); + if (ret) + pr_err("write aobus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_aobus_update_bits); + + +/* + ** VCBUS Bus REG Read Write and Update some bits + */ +int aml_read_vcbus(unsigned int reg) +{ + int ret, val; + + ret = aml_reg_read(IO_APB_BUS_BASE, (0x100000+(reg<<2)), &val); + if (ret) { + pr_err("read vcbus reg %x error %d\n", reg, ret); + return -1; + } else + return val; +} +EXPORT_SYMBOL(aml_read_vcbus); + + +void aml_write_vcbus(unsigned int reg, unsigned int val) +{ + int ret; + + ret = aml_reg_write(IO_APB_BUS_BASE, (0x100000+(reg<<2)), val); + if (ret) + pr_err("write vcbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_write_vcbus); + +void aml_vcbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val) +{ + int ret; + + ret = aml_regmap_update_bits(IO_APB_BUS_BASE, + (0x100000+(reg<<2)), mask, val); + if (ret) + pr_err("write vcbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_vcbus_update_bits); + + +/* + ** DOS BUS Bus REG Read Write and Update some bits + */ +int aml_read_dosbus(unsigned int reg) +{ + int ret, val; + + ret = aml_reg_read(IO_APB_BUS_BASE, (0x50000+(reg<<2)), &val); + if (ret) { + pr_err("read vcbus reg %x error %d\n", reg, ret); + return -1; + } else + return val; +} +EXPORT_SYMBOL(aml_read_dosbus); + +void aml_write_dosbus(unsigned int reg, unsigned int val) +{ + int ret; + + ret = aml_reg_write(IO_APB_BUS_BASE, (0x50000+(reg<<2)), val); + if (ret) + pr_err("write vcbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_write_dosbus); + +void aml_dosbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val) +{ + int ret; + + ret = aml_regmap_update_bits(IO_APB_BUS_BASE, + (0x50000+(reg<<2)), mask, val); + if (ret) + pr_err("write vcbus reg %x error %d\n", reg, ret); +} +EXPORT_SYMBOL(aml_dosbus_update_bits); + +static int iomap_probe(struct platform_device *pdev) +{ + int i = 0; +/* void __iomem *base; */ + struct resource res; + struct device_node *np, *child; + + np = pdev->dev.of_node; + + for_each_child_of_node(np, child) { + if (of_address_to_resource(child, 0, &res)) + return -1; + meson_reg_map[i] = ioremap(res.start, resource_size(&res)); + i++; + } + pr_info("amlogic iomap probe done\n"); + return 0; +} + + + +static struct platform_driver iomap_platform_driver = { + .probe = iomap_probe, + .driver = { + .owner = THIS_MODULE, + .name = "iomap_version", + .of_match_table = iomap_dt_match, + }, +}; + +int __init meson_iomap_version_init(void) +{ + + int ret; + + ret = platform_driver_register(&iomap_platform_driver); + + return ret; +} +core_initcall(meson_iomap_version_init); diff --git a/drivers/amlogic/uart/Kconfig b/drivers/amlogic/uart/Kconfig new file mode 100644 index 000000000000..ae2b2f7a4dca --- /dev/null +++ b/drivers/amlogic/uart/Kconfig @@ -0,0 +1,34 @@ +# +# Amlogic driver configuration +# + +config AMLOGIC_UART + bool "Serial support" + select SERIAL_CORE + select SERIAL_EARLYCON + default n + help + Add support for the Amlogic serial port. + this config only ctrl in makefile + this config do not in meson_uart.c + this config add + +config AMLOGIC_SERIAL_MESON_CONSOLE + bool "Console on Amlogic Serial port" + select SERIAL_CORE_CONSOLE + default n + help + Support for running a console on the Amlogic serial + this config is only + used in meson_uart.c + so so + +config AMLOGIC_PRINTK_NOBLOCK_MODE + bool "printk with no block" + depends on AMLOGIC_SERIAL_MESON_CONSOLE + default n + help + printk with no block + push tx data to internal buffer first + default size of internal buffer is 128K + when enabled, new_printk_enabled=1 diff --git a/drivers/amlogic/uart/Makefile b/drivers/amlogic/uart/Makefile new file mode 100644 index 000000000000..815158ed3a6a --- /dev/null +++ b/drivers/amlogic/uart/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_AMLOGIC_UART) += meson_uart.o \ No newline at end of file diff --git a/drivers/amlogic/uart/meson_uart.c b/drivers/amlogic/uart/meson_uart.c new file mode 100644 index 000000000000..51bff2affcf7 --- /dev/null +++ b/drivers/amlogic/uart/meson_uart.c @@ -0,0 +1,1251 @@ +/* + * drivers/amlogic/uart/meson_uart.c + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_SUPPORT_SYSRQ +#define SUPPORT_SYSRQ +#endif +#include + +#include +#include "meson_uart.h" + +/* Register offsets */ +#define AML_UART_WFIFO 0x00 +#define AML_UART_RFIFO 0x04 +#define AML_UART_CONTROL 0x08 +#define AML_UART_STATUS 0x0c +#define AML_UART_MISC 0x10 +#define AML_UART_REG5 0x14 + +/* AML_UART_CONTROL bits */ +#define AML_UART_TX_EN BIT(12) +#define AML_UART_RX_EN BIT(13) +#define AML_UART_TX_RST BIT(22) +#define AML_UART_RX_RST BIT(23) +#define AML_UART_CLR_ERR BIT(24) +#define AML_UART_RX_INT_EN BIT(27) +#define AML_UART_TX_INT_EN BIT(28) +#define AML_UART_DATA_LEN_MASK (0x03 << 20) +#define AML_UART_DATA_LEN_8BIT (0x00 << 20) +#define AML_UART_DATA_LEN_7BIT (0x01 << 20) +#define AML_UART_DATA_LEN_6BIT (0x02 << 20) +#define AML_UART_DATA_LEN_5BIT (0x03 << 20) + +/* AML_UART_STATUS bits */ +#define AML_UART_PARITY_ERR BIT(16) +#define AML_UART_FRAME_ERR BIT(17) +#define AML_UART_TX_FIFO_WERR BIT(18) +#define AML_UART_RX_EMPTY BIT(20) +#define AML_UART_TX_FULL BIT(21) +#define AML_UART_TX_EMPTY BIT(22) +#define AML_UART_RX_FIFO_OVERFLOW BIT(24) +#define AML_UART_ERR (AML_UART_PARITY_ERR | \ + AML_UART_FRAME_ERR | \ + AML_UART_RX_FIFO_OVERFLOW) + +/* AML_UART_CONTROL bits */ +#define AML_UART_TWO_WIRE_EN BIT(15) +#define AML_UART_PARITY_TYPE BIT(18) +#define AML_UART_PARITY_EN BIT(19) +#define AML_UART_CLEAR_ERR BIT(24) +#define AML_UART_STOP_BIN_LEN_MASK (0x03 << 16) +#define AML_UART_STOP_BIN_1SB (0x00 << 16) +#define AML_UART_STOP_BIN_2SB (0x01 << 16) + +/* AML_UART_MISC bits */ +#define AML_UART_XMIT_IRQ(c) (((c) & 0xff) << 8) +#define AML_UART_RECV_IRQ(c) ((c) & 0xff) + +/* AML_UART_REG5 bits */ +#define AML_UART_BAUD_MASK 0x7fffff +#define AML_UART_BAUD_USE BIT(23) +#define AML_UART_BAUD_XTAL BIT(24) +#define AML_UART_BAUD_XTAL_TICK BIT(26) + +#define AML_UART_PORT_MAX 16 +#define AML_UART_DEV_NAME "ttyS" + +/*#define UART_TEST_DEBUG*/ +static struct uart_driver meson_uart_driver; +unsigned int xtal_tick_en; +struct meson_uart_port { + struct uart_port port; + spinlock_t wr_lock; + unsigned long baud; + struct pinctrl *p; +}; + +#define to_meson_port(uport) container_of(uport, struct meson_uart_port, port) +static struct meson_uart_port *meson_ports[AML_UART_PORT_MAX]; + +struct uart_port *get_uart_port(int id) +{ + struct uart_port *port; + + port = &meson_ports[id]->port; + return port; +} +EXPORT_SYMBOL(get_uart_port); +static int meson_serial_console_setup(struct console *co, char *options); + + +/*************** printk noblock *****************/ + +#define MESON_SERIAL_BUFFER_SIZE (1024 * 128) +#define DEFAULT_STR_LEN 4 +#define DEFAULT_STR "..." + +/*0: disable 1: enable*/ +static bool new_printk_enabled; + +struct meson_uart_struct { + struct console *co; + const char *s; + unsigned long offset; + long count; + struct list_head list; +}; +struct meson_uart_management { + int user_count; + struct list_head list_head; + spinlock_t lock; +}; +struct meson_uart_list { + int user_count; + struct meson_uart_struct *co_head; + struct meson_uart_struct *co_tail; +}; + +static struct meson_uart_management cur_col_management; +static struct meson_uart_list cur_col_list[AML_UART_PORT_MAX]; +static char *data_cache; +static int meson_uart_console_index = -1; + +static int __init new_printk_enable(char *str) +{ + new_printk_enabled = 1; + return 1; +} +__setup("printk_no_block", new_printk_enable); + + +module_param_named(new_printk, new_printk_enabled, + bool, S_IRUGO | S_IWUSR); + +MODULE_PARM_DESC(new_printk, "printk use no block mode"); + +static ssize_t printk_mode_show(struct device_driver *drv, char *buf) +{ + return sprintf(buf, "0x%0x\n", new_printk_enabled); +} + +static ssize_t printk_mode_store(struct device_driver *drv, const char *buf, + size_t count) +{ + unsigned long long res = 0; + + if (!kstrtoull(buf, 16, &res)) + new_printk_enabled = res; + return count; +} + +static DRIVER_ATTR(printkmode, S_IRUGO | S_IWUSR, printk_mode_show, + printk_mode_store); + + +/*********** SYSRQ **************/ +static int support_sysrq; + +static ssize_t support_sysrq_show(struct device_driver *drv, char *buf) +{ + return sprintf(buf, "0x%0x\n", support_sysrq); +} + +static ssize_t support_sysrq_store(struct device_driver *drv, const char *buf, + size_t count) +{ + unsigned long long res = 0; + + if (!kstrtoull(buf, 16, &res)) + support_sysrq = res; + return count; +} + +static DRIVER_ATTR(sysrqsupport, S_IRUGO | S_IWUSR, support_sysrq_show, + support_sysrq_store); + + +static void get_next_node(struct meson_uart_list *cur_col, + struct meson_uart_struct *co_struct, int index) +{ + struct list_head *entry; + struct console *co = NULL; + struct list_head *list_head = NULL; + + cur_col->user_count--; + + list_del(&co_struct->list); + + co_struct = NULL; + list_head = &cur_col_management.list_head; + if (!list_empty(list_head)) { + cur_col_management.user_count--; + list_for_each_prev(entry, list_head) { + co_struct = list_entry(entry, + struct meson_uart_struct, list); + co = co_struct->co; + if (co->index == index) + break; + } + } + if (co_struct && (co->index == index)) { + cur_col->co_head = co_struct; + } else { + cur_col->co_head = NULL; + cur_col->co_tail = NULL; + cur_col->user_count = 0; + } +} +static int print_more(struct meson_uart_port *mup) +{ + int index = 0; + struct meson_uart_struct *co_struct = NULL; + struct meson_uart_port *mup_tmp = NULL; + struct meson_uart_list *cur_col = NULL; + struct console *co = NULL; + const char *s = NULL; + unsigned long flags = 0; + + spin_lock_irqsave(&cur_col_management.lock, flags); + if (!data_cache || list_empty(&cur_col_management.list_head)) + goto no_data_print; + + for (index = 0; index < AML_UART_PORT_MAX; index++) { + mup_tmp = meson_ports[index]; + if (mup == mup_tmp) + break; + } + if (index >= AML_UART_PORT_MAX) + goto no_data_print; + + cur_col = &cur_col_list[index]; + if ((cur_col->user_count == 0) || !cur_col->co_head) + goto no_data_print; + + co_struct = cur_col->co_head; + co = co_struct->co; + index = co->index; + if (index < 0) + goto no_data_print; + + spin_lock(&mup->wr_lock); + if (index != meson_uart_console_index) + meson_serial_console_setup(co, NULL); + + while ((readl(mup->port.membase + AML_UART_CONTROL) & AML_UART_TX_EN) + && (!(readl(mup->port.membase + AML_UART_STATUS) + & AML_UART_TX_FULL))) { + if (co_struct->count <= 0) { + get_next_node(cur_col, co_struct, index); + if (!cur_col->co_head) + break; + co_struct = cur_col->co_head; + } + s = co_struct->s + co_struct->offset; + if (*s == '\n') + writel('\r', mup->port.membase + AML_UART_WFIFO); + writel(*s++, mup->port.membase + AML_UART_WFIFO); + co_struct->count--; + co_struct->offset++; + } + + spin_unlock(&mup->wr_lock); + +no_data_print: + spin_unlock_irqrestore(&cur_col_management.lock, flags); + return 0; +} + +static void meson_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) +{ +} + +static unsigned int meson_uart_get_mctrl(struct uart_port *port) +{ + return TIOCM_CTS; +} + +static unsigned int meson_uart_tx_empty(struct uart_port *port) +{ + u32 val; + + val = readl(port->membase + AML_UART_STATUS); + return (val & AML_UART_TX_EMPTY) ? TIOCSER_TEMT : 0; +} + +static void meson_uart_stop_tx(struct uart_port *port) +{ + u32 val; + + val = readl(port->membase + AML_UART_CONTROL); + val &= ~AML_UART_TX_EN; + writel(val, port->membase + AML_UART_CONTROL); +} + +static void meson_uart_stop_rx(struct uart_port *port) +{ + u32 val; + + val = readl(port->membase + AML_UART_CONTROL); + val &= ~AML_UART_RX_EN; + writel(val, port->membase + AML_UART_CONTROL); +} + +static void meson_uart_shutdown(struct uart_port *port) +{ + unsigned long flags; + u32 val; + + if (port->line == 0) + return; + + spin_lock_irqsave(&port->lock, flags); + + val = readl(port->membase + AML_UART_CONTROL); + val &= ~(AML_UART_RX_EN | AML_UART_TX_EN); + val &= ~(AML_UART_RX_INT_EN | AML_UART_TX_INT_EN); + writel(val, port->membase + AML_UART_CONTROL); + + spin_unlock_irqrestore(&port->lock, flags); +} + +static void meson_uart_start_tx(struct uart_port *port) +{ + struct circ_buf *xmit = &port->state->xmit; + unsigned int ch; + struct meson_uart_port *mup = to_meson_port(port); + unsigned long flags; + + spin_lock_irqsave(&mup->wr_lock, flags); + while (!uart_circ_empty(xmit)) { + if (!(readl(port->membase + AML_UART_STATUS) & + AML_UART_TX_FULL)) { + ch = xmit->buf[xmit->tail]; + writel(ch, port->membase + AML_UART_WFIFO); + xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1); + port->icount.tx++; + } else + break; + } + spin_unlock_irqrestore(&mup->wr_lock, flags); +} + +static void meson_transmit_chars(struct uart_port *port) +{ + struct circ_buf *xmit = &port->state->xmit; + struct meson_uart_port *mup = to_meson_port(port); + unsigned int ch; + int count = 256; + + if (port->x_char) { + writel(port->x_char, port->membase + AML_UART_WFIFO); + port->icount.tx++; + port->x_char = 0; + goto clear_and_return; + } + + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) + goto clear_and_return; + + spin_lock(&mup->wr_lock); + while (!uart_circ_empty(xmit) && count-- > 0) { + if (!(readl(port->membase + AML_UART_STATUS) & + AML_UART_TX_FULL)) { + ch = xmit->buf[xmit->tail]; + writel(ch, port->membase + AML_UART_WFIFO); + xmit->tail = (xmit->tail + 1) & (SERIAL_XMIT_SIZE - 1); + port->icount.tx++; + } else + break; + } + spin_unlock(&mup->wr_lock); + + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(port); + + clear_and_return: + return; + +} + +static void meson_receive_chars(struct uart_port *port) +{ + struct tty_port *tport = &port->state->port; + char flag; + u32 status, ch, mode; + + spin_lock(&port->lock); + do { + flag = TTY_NORMAL; + port->icount.rx++; + status = readl(port->membase + AML_UART_STATUS); + + if (status & AML_UART_ERR) { + if (status & AML_UART_RX_FIFO_OVERFLOW) + port->icount.overrun++; + else if (status & AML_UART_FRAME_ERR) + port->icount.frame++; + else if (status & AML_UART_PARITY_ERR) + port->icount.frame++; + + mode = readl(port->membase + AML_UART_CONTROL); + mode |= AML_UART_CLEAR_ERR; + writel(mode, port->membase + AML_UART_CONTROL); + + /* It doesn't clear to 0 automatically */ + mode &= ~AML_UART_CLEAR_ERR; + writel(mode, port->membase + AML_UART_CONTROL); + + status &= port->read_status_mask; + if (status & (AML_UART_FRAME_ERR | + AML_UART_RX_FIFO_OVERFLOW)) + flag = TTY_FRAME; + else if (status & AML_UART_PARITY_ERR) + flag = TTY_PARITY; + } + + ch = readl(port->membase + AML_UART_RFIFO); + ch &= 0xff; + +#ifdef SUPPORT_SYSRQ + if (support_sysrq == 1) { + if ((status == 0) && (ch == 0)) { + port->icount.brk++; + if (uart_handle_break(port)) + continue; + } + + if (port->sysrq) + flag = TTY_BREAK; + + if (uart_handle_sysrq_char(port, ch)) + continue; + } +#endif + + uart_insert_char(port, status, AML_UART_RX_FIFO_OVERFLOW, + ch, flag); + /* + * if ((status & port->ignore_status_mask) == 0) + * tty_insert_flip_char(tport, ch, flag); + * + * if (status & AML_UART_TX_FIFO_WERR) + * tty_insert_flip_char(tport, 0, TTY_OVERRUN); + */ + } while (!(readl(port->membase + AML_UART_STATUS) & AML_UART_RX_EMPTY)); + spin_unlock(&port->lock); + + tty_flip_buffer_push(tport); + +} + +static irqreturn_t meson_uart_interrupt(int irq, void *dev_id) +{ + struct uart_port *port = (struct uart_port *)dev_id; + u32 val; + struct meson_uart_port *mup = to_meson_port(port); + + spin_lock(&port->lock); + val = readl(port->membase + AML_UART_CONTROL); + spin_unlock(&port->lock); + if (!(readl(port->membase + AML_UART_STATUS) & AML_UART_RX_EMPTY)) + meson_receive_chars(port); + + if ((val & AML_UART_TX_EN) + && (!(readl(port->membase + AML_UART_STATUS) & AML_UART_TX_FULL))) + meson_transmit_chars(port); + + if (!list_empty(&cur_col_management.list_head)) + print_more(mup); + + return IRQ_HANDLED; +} + +static const char *meson_uart_type(struct uart_port *port) +{ + return (port->type == PORT_MESON) ? "meson_uart" : NULL; +} + +static int meson_uart_startup(struct uart_port *port) +{ + u32 val; + int ret = 0; + + val = readl(port->membase + AML_UART_CONTROL); + val |= (AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR); + writel(val, port->membase + AML_UART_CONTROL); + + val &= ~(AML_UART_RX_RST | AML_UART_TX_RST | AML_UART_CLR_ERR); + writel(val, port->membase + AML_UART_CONTROL); + + val |= (AML_UART_RX_EN | AML_UART_TX_EN); + writel(val, port->membase + AML_UART_CONTROL); + + val |= (AML_UART_RX_INT_EN | AML_UART_TX_INT_EN); + writel(val, port->membase + AML_UART_CONTROL); + + return ret; +} + +static void meson_uart_change_speed(struct uart_port *port, unsigned long baud) +{ + u32 val; + struct meson_uart_port *mup = to_meson_port(port); + struct platform_device *pdev = to_platform_device(port->dev); + + while (!(readl(port->membase + AML_UART_STATUS) & AML_UART_TX_EMPTY)) + cpu_relax(); + +#ifdef UART_TEST_DEBUG + if (port->line != 0) + baud = 115200; +#endif + val = readl(port->membase + AML_UART_REG5); + val &= ~AML_UART_BAUD_MASK; + if (port->uartclk == 24000000) { + if (xtal_tick_en) { + /*xtal_tick_en first*/ + aml_aobus_update_bits((0x19<<2), (1<<18), (1<<18)); + dev_info(&pdev->dev, "ttyS%d use xtal(24M) %d change %ld to %ld\n", + port->line, port->uartclk, + mup->baud, baud); + val = (port->uartclk) / baud - 1; + val |= (AML_UART_BAUD_USE|AML_UART_BAUD_XTAL + |AML_UART_BAUD_XTAL_TICK); + } else { + dev_info(&pdev->dev, "ttyS%d use xtal(8M) %d change %ld to %ld\n", + port->line, port->uartclk, + mup->baud, baud); + val = (port->uartclk / 3) / baud - 1; + val |= (AML_UART_BAUD_USE|AML_UART_BAUD_XTAL); + } + } else { + dev_info(&pdev->dev, "ttyS%d use clk81 %d change %ld to %ld\n", + port->line, port->uartclk, + mup->baud, baud); + val = ((port->uartclk * 10 / (baud * 4) + 5) / 10) - 1; + val |= AML_UART_BAUD_USE; + } + writel(val, port->membase + AML_UART_REG5); + + mup->baud = baud; +} + +static void meson_uart_set_termios(struct uart_port *port, + struct ktermios *termios, + struct ktermios *old) +{ + unsigned int cflags, iflags, baud; + unsigned long flags; + u32 val; + + spin_lock_irqsave(&port->lock, flags); + + cflags = termios->c_cflag; + iflags = termios->c_iflag; + + val = readl(port->membase + AML_UART_CONTROL); + + val &= ~AML_UART_DATA_LEN_MASK; + switch (cflags & CSIZE) { + case CS8: + val |= AML_UART_DATA_LEN_8BIT; + break; + case CS7: + val |= AML_UART_DATA_LEN_7BIT; + break; + case CS6: + val |= AML_UART_DATA_LEN_6BIT; + break; + case CS5: + val |= AML_UART_DATA_LEN_5BIT; + break; + } + + if (cflags & PARENB) + val |= AML_UART_PARITY_EN; + else + val &= ~AML_UART_PARITY_EN; + + if (cflags & PARODD) + val |= AML_UART_PARITY_TYPE; + else + val &= ~AML_UART_PARITY_TYPE; + + val &= ~AML_UART_STOP_BIN_LEN_MASK; + if (cflags & CSTOPB) + val |= AML_UART_STOP_BIN_2SB; + else + val &= ~AML_UART_STOP_BIN_1SB; + + if (cflags & CRTSCTS) + val &= ~AML_UART_TWO_WIRE_EN; + else + val |= AML_UART_TWO_WIRE_EN; + + writel(val, port->membase + AML_UART_CONTROL); + spin_unlock_irqrestore(&port->lock, flags); + + baud = uart_get_baud_rate(port, termios, old, 9600, 4000000); + meson_uart_change_speed(port, baud); + + port->read_status_mask = AML_UART_RX_FIFO_OVERFLOW; + if (iflags & INPCK) + port->read_status_mask |= AML_UART_PARITY_ERR | + AML_UART_FRAME_ERR; + + port->ignore_status_mask = 0; + if (iflags & IGNPAR) + port->ignore_status_mask |= AML_UART_PARITY_ERR | + AML_UART_FRAME_ERR; + + uart_update_timeout(port, termios->c_cflag, baud); +} + +static int meson_uart_verify_port(struct uart_port *port, + struct serial_struct *ser) +{ + int ret = 0; + + if (port->type != PORT_MESON) + ret = -EINVAL; + if (port->irq != ser->irq) + ret = -EINVAL; + if (ser->baud_base < 9600) + ret = -EINVAL; + return ret; +} + +static void meson_uart_release_port(struct uart_port *port) +{ + if (port->flags & UPF_IOREMAP) { + iounmap(port->membase); + port->membase = NULL; + } +} + +static int meson_uart_request_port(struct uart_port *port) +{ + struct platform_device *pdev = to_platform_device(port->dev); + struct resource *res; + int size, ret; + u32 val; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "cannot obtain I/O memory region"); + return -ENODEV; + } + size = resource_size(res); + + if (!devm_request_mem_region(port->dev, port->mapbase, size, + dev_name(port->dev))) { + dev_err(port->dev, "Memory region busy\n"); + return -EBUSY; + } + + if (port->flags & UPF_IOREMAP) { + port->membase = devm_ioremap_nocache(port->dev, + port->mapbase, size); + if (port->membase == NULL) + return -ENOMEM; + } + + dev_info(&pdev->dev, "==uart%d reg addr = %p\n", + port->line, port->membase); + val = (AML_UART_RECV_IRQ(1) | AML_UART_XMIT_IRQ(port->fifosize / 2)); + writel(val, port->membase + AML_UART_MISC); + + ret = request_irq(port->irq, meson_uart_interrupt, 0, + meson_uart_type(port), port); + return 0; +} + +static void meson_uart_config_port(struct uart_port *port, int flags) +{ + if (flags & UART_CONFIG_TYPE) { + port->type = PORT_MESON; + meson_uart_request_port(port); + } +} + +static struct uart_ops const meson_uart_ops = { + .set_mctrl = meson_uart_set_mctrl, + .get_mctrl = meson_uart_get_mctrl, + .tx_empty = meson_uart_tx_empty, + .start_tx = meson_uart_start_tx, + .stop_tx = meson_uart_stop_tx, + .stop_rx = meson_uart_stop_rx, + .startup = meson_uart_startup, + .shutdown = meson_uart_shutdown, + .set_termios = meson_uart_set_termios, + .type = meson_uart_type, + .config_port = meson_uart_config_port, + .request_port = meson_uart_request_port, + .release_port = meson_uart_release_port, + .verify_port = meson_uart_verify_port, +}; + +#ifdef CONFIG_AMLOGIC_SERIAL_MESON_CONSOLE + +static void meson_console_putchar(struct uart_port *port, int ch) +{ + if (!port->membase) + return; + + while (readl(port->membase + AML_UART_STATUS) & AML_UART_TX_FULL) + cpu_relax(); + writel(ch, port->membase + AML_UART_WFIFO); +} + +static void meson_serial_console_write(struct console *co, const char *s, + u_int count) +{ + struct uart_port *port; + + const char *cur_s = NULL; + struct meson_uart_struct *head_s = NULL; + struct meson_uart_struct *tail_s = NULL; + struct list_head *list_head = NULL; + struct meson_uart_struct *co_struct = NULL; + struct meson_uart_list *cur_col = NULL; + long tmp_count = 0; + long tmp_count_1 = 0; + long struct_size = sizeof(struct meson_uart_struct); + int need_default = 0; + static int last_msg_full; + unsigned long flags = 0; + int index = co->index; + + port = &meson_ports[co->index]->port; + if (!port) + return; + if (!new_printk_enabled || !data_cache) { + uart_console_write(port, s, count, meson_console_putchar); + return; + } + + spin_lock_irqsave(&cur_col_management.lock, flags); + + if (count > 0 && count < MESON_SERIAL_BUFFER_SIZE) { + list_head = &cur_col_management.list_head; + cur_s = NULL; + if (list_empty(list_head)) { + cur_s = data_cache; + } else { + head_s = list_entry(list_head->prev, + struct meson_uart_struct, list); + tail_s = list_entry(list_head->next, + struct meson_uart_struct, list); + tmp_count_1 = (struct_size << 1) + + (unsigned long)tail_s->s + tail_s->offset + + tail_s->count; + if (head_s->s <= tail_s->s) { + tmp_count = data_cache + + MESON_SERIAL_BUFFER_SIZE + - tail_s->s - tail_s->offset + - tail_s->count; + if (tmp_count < (long long)count + struct_size + + (struct_size+DEFAULT_STR_LEN)) { + if ((head_s->s > (data_cache + + (struct_size << 1))) + && ((head_s->s - + (data_cache + + (struct_size << 1))) + > count + +(struct_size + +DEFAULT_STR_LEN))) { + cur_s = data_cache; + } else if (tmp_count > (struct_size + + DEFAULT_STR_LEN)) { + cur_s = tail_s->s + + tail_s->offset + tail_s->count; + need_default = 1; + } else { + cur_s = data_cache; + need_default = 1; + } + } else { + cur_s = tail_s->s + tail_s->offset + + tail_s->count; + } + } else if (((long)head_s->s > tmp_count_1) + && ((long)head_s->s - tmp_count_1 + > count + (struct_size+DEFAULT_STR_LEN))) { + cur_s = tail_s->s + tail_s->offset + + tail_s->count; + } else { + cur_s = tail_s->s + tail_s->offset + + tail_s->count; + need_default = 1; + } + } + + if (need_default == 0) { + co_struct = (struct meson_uart_struct *)cur_s; + co_struct->s = cur_s + struct_size; + co_struct->count = count; + co_struct->co = co; + co_struct->offset = 0; + cur_col = &cur_col_list[index]; + cur_col->co_tail = co_struct; + if (!cur_col->co_head) + cur_col->co_head = co_struct; + + cur_col->user_count++; + cur_col_management.user_count++; + memcpy((char *)(co_struct->s), (char *)s, count); + list_add(&co_struct->list, + &cur_col_management.list_head); + last_msg_full = 0; + } else { + if (last_msg_full == 0) { + co_struct = (struct meson_uart_struct *)cur_s; + co_struct->s = cur_s + struct_size; + co_struct->count = DEFAULT_STR_LEN; + co_struct->co = co; + co_struct->offset = 0; + cur_col = &cur_col_list[index]; + cur_col->co_tail = co_struct; + if (!cur_col->co_head) + cur_col->co_head = co_struct; + + cur_col->user_count++; + cur_col_management.user_count++; + memcpy((char *)(co_struct->s), + DEFAULT_STR, DEFAULT_STR_LEN); + s = co_struct->s; + *((char *)s + DEFAULT_STR_LEN-1) = '\n'; + + list_add(&co_struct->list, + &cur_col_management.list_head); + last_msg_full = 1; + } + } + + + cur_col = &cur_col_list[index]; + if (cur_col->co_head) { + co_struct = cur_col->co_head; + s = co_struct->s + co_struct->offset; + if (index != meson_uart_console_index) + meson_serial_console_setup(co, NULL); + + while ((readl(port->membase + AML_UART_CONTROL) + & AML_UART_TX_EN) + && (!(readl(port->membase + AML_UART_STATUS) + & AML_UART_TX_FULL))) { + if (co_struct->count <= 0) { + get_next_node(cur_col, + co_struct, index); + if (!cur_col->co_head) + break; + co_struct = cur_col->co_head; + s = co_struct->s + co_struct->offset; + } + if (*s == '\n') + writel('\r', port->membase + + AML_UART_WFIFO); + writel(*s++, port->membase + AML_UART_WFIFO); + co_struct->count--; + co_struct->offset++; + } + + } + + } + spin_unlock_irqrestore(&cur_col_management.lock, flags); + +} + +static int meson_serial_console_setup(struct console *co, char *options) +{ + struct uart_port *port; + int baud = 115200; + int bits = 8; + int parity = 'n'; + int flow = 'n'; + + if (co->index < 0 || co->index >= AML_UART_PORT_MAX) + return -EINVAL; + + meson_uart_console_index = (int)co->index; + + port = &meson_ports[co->index]->port; + if (!port || !port->membase) + return -ENODEV; + + if (options) + uart_parse_options(options, &baud, &parity, &bits, &flow); + + return uart_set_options(port, co, baud, parity, bits, flow); +} + +static void meson_early_write(struct console *con, const char *s, + unsigned int n) +{ + struct earlycon_device *dev = con->data; + + uart_console_write(&dev->port, s, n, meson_console_putchar); +} + +static int __init meson_early_console_setup(struct earlycon_device *device, + const char *opt) +{ + if (!device->port.membase) + return -ENODEV; + + device->con->write = meson_early_write; + return 0; +} +EARLYCON_DECLARE(aml_uart, meson_early_console_setup); + +static struct console meson_serial_console = { + .name = AML_UART_DEV_NAME, + .write = meson_serial_console_write, + .device = uart_console_device, + .setup = meson_serial_console_setup, + .flags = CON_PRINTBUFFER, + .index = -1, + .data = &meson_uart_driver, +}; + +static int __init meson_serial_console_init(void) +{ + register_console(&meson_serial_console); + return 0; +} + +console_initcall(meson_serial_console_init); + +#define MESON_SERIAL_CONSOLE (&meson_serial_console) +#else +#define MESON_SERIAL_CONSOLE NULL +#endif + +static struct uart_driver meson_uart_driver = { + .owner = THIS_MODULE, + .driver_name = "meson_uart", + .dev_name = AML_UART_DEV_NAME, + .nr = AML_UART_PORT_MAX, + .cons = MESON_SERIAL_CONSOLE, +}; + +#ifdef CONFIG_HIBERNATION +static u32 save_mode; + +static int meson_uart_freeze(struct device *dev) +{ + struct platform_device *pdev; + struct uart_port *port; + + pdev = to_platform_device(dev); + port = platform_get_drvdata(pdev); + + save_mode = readl(port->membase + AML_UART_CONTROL); + + pr_debug("uart freeze, mode: %x\n", save_mode); + + return 0; +} + +static int meson_uart_thaw(struct device *dev) +{ + return 0; +} + +static int meson_uart_restore(struct device *dev) +{ + struct platform_device *pdev; + struct uart_port *port; + + pdev = to_platform_device(dev); + port = platform_get_drvdata(pdev); + + writel(save_mode, port->membase + AML_UART_CONTROL); + pr_debug("uart restore, mode: %x\n", save_mode); + return 0; +} + +static int meson_uart_suspend(struct platform_device *pdev, + pm_message_t state); +static int meson_uart_resume(struct platform_device *pdev); +static int meson_uart_pm_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + + return meson_uart_suspend(pdev, PMSG_SUSPEND); + +} +static int meson_uart_pm_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + + return meson_uart_resume(pdev); +} +const struct dev_pm_ops meson_uart_pm = { + .freeze = meson_uart_freeze, + .thaw = meson_uart_thaw, + .restore = meson_uart_restore, + .suspend = meson_uart_pm_suspend, + .resume = meson_uart_pm_resume, +}; +#endif + +static int meson_uart_probe(struct platform_device *pdev) +{ + struct resource *res_mem, *res_irq; + struct uart_port *port; + struct meson_uart_port *mup; + /*struct clk *clk;*/ + const void *prop; + struct reset_control *uart_rst; + int ret = 0; + + if (pdev->dev.of_node) + pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); + + if (pdev->id < 0 || pdev->id >= AML_UART_PORT_MAX) + return -EINVAL; + + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res_mem) + return -ENODEV; + + res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res_irq) + return -ENODEV; + + if (meson_ports[pdev->id]) { + dev_err(&pdev->dev, "port %d already allocated\n", pdev->id); + return -EBUSY; + } + + mup = devm_kzalloc(&pdev->dev, + sizeof(struct meson_uart_port), GFP_KERNEL); + if (!mup) + return -ENOMEM; + + spin_lock_init(&mup->wr_lock); + port = &mup->port; +#if 0 + clk = clk_get(&pdev->dev, "clk_uart"); + if (IS_ERR(clk)) { + pr_err("%s: clock not found\n", dev_name(&pdev->dev)); + /* return PTR_ERR(clk); */ + } + ret = clk_prepare_enable(clk); + if (ret) { + pr_err("uart: clock failed to prepare+enable: %d\n", ret); + clk_put(clk); + /* return ret; */ + } +#endif + uart_rst = devm_reset_control_get(&pdev->dev, NULL); + if (!IS_ERR(uart_rst)) + reset_control_deassert(uart_rst); + + port->fifosize = 64; + prop = of_get_property(pdev->dev.of_node, "fifosize", NULL); + if (prop) + port->fifosize = of_read_ulong(prop, 1); + + if (!xtal_tick_en) { + prop = of_get_property(pdev->dev.of_node, "xtal_tick_en", NULL); + if (prop) + xtal_tick_en = of_read_ulong(prop, 1); + } + xtal_tick_en = 0; + port->uartclk = 24000000; + port->iotype = UPIO_MEM; + port->mapbase = res_mem->start; + port->irq = res_irq->start; + port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY; + port->dev = &pdev->dev; + port->line = pdev->id; + port->type = PORT_MESON; + port->x_char = 0; + port->ops = &meson_uart_ops; + + meson_ports[pdev->id] = mup; + platform_set_drvdata(pdev, port); + if (of_get_property(pdev->dev.of_node, "pinctrl-names", NULL)) { + mup->p = devm_pinctrl_get_select_default(&pdev->dev); + /* if (!mup->p) */ + /* return -1; */ + } + ret = uart_add_one_port(&meson_uart_driver, port); + if (ret) + meson_ports[pdev->id] = NULL; + + prop = of_get_property(pdev->dev.of_node, "support-sysrq", NULL); + if (prop) + support_sysrq = of_read_ulong(prop, 1); + + return ret; +} + +static int meson_uart_remove(struct platform_device *pdev) +{ + struct uart_port *port; + + port = platform_get_drvdata(pdev); + uart_remove_one_port(&meson_uart_driver, port); + meson_ports[pdev->id] = NULL; + + return 0; +} + +static int meson_uart_resume(struct platform_device *pdev) +{ + struct uart_port *port; + u32 val; + + port = platform_get_drvdata(pdev); + if (port) { + if (port->line == 0) + return 0; + uart_resume_port(&meson_uart_driver, port); + } + + val = readl(port->membase + AML_UART_CONTROL); + if (!(val & AML_UART_TWO_WIRE_EN)) { + val &= ~(0x1 << 31); + writel(val, port->membase + AML_UART_CONTROL); + } + + return 0; +} + +static int meson_uart_suspend(struct platform_device *pdev, + pm_message_t state) +{ + struct uart_port *port; + u32 val; + + port = platform_get_drvdata(pdev); + if (port) { + if (port->line == 0) + return 0; + uart_suspend_port(&meson_uart_driver, port); + } + val = readl(port->membase + AML_UART_CONTROL); + /* if rts/cts is open, pull up rts pin + * when in suspend + */ + if (!(val & AML_UART_TWO_WIRE_EN)) { + dev_info(&pdev->dev, "pull up rts"); + val |= (0x1 << 31); + writel(val, port->membase + AML_UART_CONTROL); + } + + return 0; +} + +static const struct of_device_id meson_uart_dt_match[] = { + {.compatible = "amlogic, meson-uart"}, + { /* sentinel */ }, +}; + +MODULE_DEVICE_TABLE(of, meson_uart_dt_match); + +static struct platform_driver meson_uart_platform_driver = { + .probe = meson_uart_probe, + .remove = meson_uart_remove, + .suspend = meson_uart_suspend, + .resume = meson_uart_resume, + .driver = { + .owner = THIS_MODULE, + .name = "meson_uart", + .of_match_table = meson_uart_dt_match, +#ifdef CONFIG_HIBERNATION + .pm = &meson_uart_pm, +#endif + }, +}; + +static int __init meson_uart_init(void) +{ + int ret; + + ret = uart_register_driver(&meson_uart_driver); + if (ret) + return ret; + + ret = platform_driver_register(&meson_uart_platform_driver); + if (ret) + uart_unregister_driver(&meson_uart_driver); + + ret = driver_create_file(&meson_uart_platform_driver.driver, + &driver_attr_printkmode); + + ret = driver_create_file(&meson_uart_platform_driver.driver, + &driver_attr_sysrqsupport); + + INIT_LIST_HEAD(&cur_col_management.list_head); + spin_lock_init(&cur_col_management.lock); + data_cache = vmalloc(MESON_SERIAL_BUFFER_SIZE); + if (!data_cache) { + pr_info("buffer alloc failed for uart\n"); + platform_driver_unregister(&meson_uart_platform_driver); + uart_unregister_driver(&meson_uart_driver); + return -ENOMEM; + } + + return ret; +} + +static void __exit meson_uart_exit(void) +{ + platform_driver_unregister(&meson_uart_platform_driver); + uart_unregister_driver(&meson_uart_driver); +} + +module_init(meson_uart_init); +module_exit(meson_uart_exit); + +MODULE_AUTHOR("Carlo Caione "); +MODULE_DESCRIPTION("Amlogic Meson serial port driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/amlogic/uart/meson_uart.h b/drivers/amlogic/uart/meson_uart.h new file mode 100644 index 000000000000..af16c6a46447 --- /dev/null +++ b/drivers/amlogic/uart/meson_uart.h @@ -0,0 +1,102 @@ +/* + * drivers/amlogic/uart/meson_uart.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef _LINUX_AM_UART_H +#define _LINUX_AM_UART_H +/* #include */ + +#define UART_OVERFLOW_ERR (0x01<<18) +#define UART_FRAME_ERR (0x01<<17) +#define UART_PARITY_ERR (0x01<<16) + +#define UART_CLEAR_ERR (0x01<<24) + +#define UART_RXENB (0x01<<13) +#define UART_RXEMPTY (0x01<<20) +#define UART_RXFULL (0x01<<19) +#define UART_TXENB (0x01<<12) +#define UART_TXEMPTY (0x01<<22) +#define UART_TXFULL (0x01<<21) + +#define UART_TXRST (0x01<<22) +#define UART_RXRST (0x01<<23) +#define UART_RXINT_EN (0x01<<27) +#define UART_TXINT_EN (0x01<<28) + +#define UART_WFIFO 0 +#define UART_RFIFO 1 +#define UART_CONTROL 2 +#define UART_STATUS 3 +#define UART_MISC 4 +#define UART_REG5 5 + +#define P_UART(uart_base, reg) CBUS_REG_ADDR(uart_base+reg) +#define P_UART_WFIFO(uart_base) P_UART(uart_base, UART_WFIFO) +#define P_UART_RFIFO(uart_base) P_UART(uart_base, UART_RFIFO) + +#define P_UART_CONTROL(uart_base) P_UART(uart_base, UART_CONTROL) + #define UART_CNTL_MASK_BAUD_RATE (0xfff) + #define UART_CNTL_MASK_TX_EN (1<<12) + #define UART_CNTL_MASK_RX_EN (1<<13) + #define UART_CNTL_MASK_2WIRE (1<<15) + #define UART_CNTL_MASK_STP_BITS (3<<16) + #define UART_CNTL_MASK_STP_1BIT (0<<16) + #define UART_CNTL_MASK_STP_2BIT (1<<16) + #define UART_CNTL_MASK_PRTY_EVEN (0<<18) + #define UART_CNTL_MASK_PRTY_ODD (1<<18) + #define UART_CNTL_MASK_PRTY_TYPE (1<<18) + #define UART_CNTL_MASK_PRTY_EN (1<<19) + #define UART_CNTL_MASK_CHAR_LEN (3<<20) + #define UART_CNTL_MASK_CHAR_8BIT (0<<20) + #define UART_CNTL_MASK_CHAR_7BIT (1<<20) + #define UART_CNTL_MASK_CHAR_6BIT (2<<20) + #define UART_CNTL_MASK_CHAR_5BIT (3<<20) + #define UART_CNTL_MASK_RST_TX (1<<22) + #define UART_CNTL_MASK_RST_RX (1<<23) + #define UART_CNTL_MASK_CLR_ERR (1<<24) + #define UART_CNTL_MASK_INV_RX (1<<25) + #define UART_CNTL_MASK_INV_TX (1<<26) + #define UART_CNTL_MASK_RINT_EN (1<<27) + #define UART_CNTL_MASK_TINT_EN (1<<28) + #define UART_CNTL_MASK_INV_CTS (1<<29) + #define UART_CNTL_MASK_MASK_ERR (1<<30) + #define UART_CNTL_MASK_INV_RTS (1<<31) + #define P_UART_STATUS(uart_base) P_UART(uart_base, UART_STATUS) + #define UART_STAT_MASK_RFIFO_CNT (0x7f<<0) + #define UART_STAT_MASK_TFIFO_CNT (0x7f<<8) + #define UART_STAT_MASK_PRTY_ERR (1<<16) + #define UART_STAT_MASK_FRAM_ERR (1<<17) + #define UART_STAT_MASK_WFULL_ERR (1<<18) + #define UART_STAT_MASK_RFIFO_FULL (1<<19) + #define UART_STAT_MASK_RFIFO_EMPTY (1<<20) + #define UART_STAT_MASK_TFIFO_FULL (1<<21) + #define UART_STAT_MASK_TFIFO_EMPTY (1<<22) +#define P_UART_MISC(uart_base) P_UART(uart_base, UART_MISC) + + +#define SERIAL_MAGIC 0x5301 + +/* + * This should be used by drivers which want to register + * their own 8250 ports without registering their own + * platform device. Using these will make your driver + * dependent on the 8250 driver. + */ +struct uart_port; + + +#endif diff --git a/include/linux/amlogic/iomap.h b/include/linux/amlogic/iomap.h new file mode 100644 index 000000000000..c5f2653f34ec --- /dev/null +++ b/include/linux/amlogic/iomap.h @@ -0,0 +1,83 @@ +/* + * include/linux/amlogic/iomap.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#ifndef __SOC_IO_H +#define __SOC_IO_H + +enum{ + IO_CBUS_BASE = 0, + IO_APB_BUS_BASE, + IO_AOBUS_BASE, + IO_HIUBUS_BASE, + IO_BUS_MAX, +}; +extern int aml_reg_read(u32 bus_type, unsigned int reg, unsigned int *val); +extern int aml_reg_write(u32 bus_type, unsigned int reg, unsigned int val); +extern int aml_regmap_update_bits(u32 bus_type, + unsigned int reg, unsigned int mask, + unsigned int val); +/* + ** CBUS REG Read Write and Update some bits + */ +extern int aml_read_cbus(unsigned int reg); + + +extern void aml_write_cbus(unsigned int reg, unsigned int val); + + +extern void aml_cbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val); + +/* + ** AO REG Read Write and Update some bits + */ +extern int aml_read_aobus(unsigned int reg); + + +extern void aml_write_aobus(unsigned int reg, unsigned int val); + + +extern void aml_aobus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val); + + + +/* + ** VCBUS Bus REG Read Write and Update some bits + */ +extern int aml_read_vcbus(unsigned int reg); + +extern void aml_write_vcbus(unsigned int reg, unsigned int val); + +extern void aml_vcbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val); + + +/* + ** DOS BUS Bus REG Read Write and Update some bits + */ +extern int aml_read_dosbus(unsigned int reg); + +extern void aml_write_dosbus(unsigned int reg, unsigned int val); + +extern void aml_dosbus_update_bits(unsigned int reg, + unsigned int mask, unsigned int val); + +extern int aml_read_sec_reg(unsigned int reg); +extern void aml_write_sec_reg(unsigned int reg, unsigned int val); + +#endif diff --git a/scripts/amlogic/licence_check.pl b/scripts/amlogic/licence_check.pl new file mode 100755 index 000000000000..77584c7486a4 --- /dev/null +++ b/scripts/amlogic/licence_check.pl @@ -0,0 +1,185 @@ +#!/usr/bin/perl -W +# +# licence_check.pl V0.10 +# +# jianxin.pan@2016-11-25 + + +use File::Basename; +use File::Find; + +$sc_dir = File::Spec->rel2abs(dirname( "$0") ) ; +$sc_dir =~ s/\/scripts\/amlogic//; +my $top = "$sc_dir"; + +my $nofix = 0; +my $failno = 0; +my $shname = $0; +#@ARGV=("../../include/linux/amlogic","../../drivers/amlogic" ) ; +my @path; +for(@ARGV) +{ + my $dir =$_; + if(/^\//) + { + } + elsif(/--nofix/) + { + $nofix = 1; + next; + } + else + { + $dir = File::Spec->rel2abs($dir); + #print "\n Real2abs Dir: --$dir-- \n"; + } + push(@path,$dir); +} + + +my $licence= +"/* + * File_name_here + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */\n\n"; + + +#print $licence; + +sub licence_process +{ + my ($file_name) = @_; + my $d = dirname($file_name); + my $f = basename($file_name); + #print "\n Abs <$d>, f_ $f"; + #print "\n Top: <$top> "; + my $log_name = File::Spec->abs2rel($d, $top); + $log_name =$log_name."\/"; + $log_name .=basename($file_name); + my $len = length($log_name); + if($len > 76) + { + $log_name =basename($file_name); + $len = length($log_name); + if($len > 76) + { + $log_name =""; + } + } + #print "\n Process: ",$log_name; + $licence_0=$licence; + $licence_0=~s/File_name_here/$log_name/; + my $count = 0; + my $text_0=""; + my $text_all=$licence_0; + open(my $f_in, '<', $file_name) or die "Can't Open $file_name: For Read \n"; + my ($left,$right, $lineno,$space) = (0, 0, 0,0); + while ($line = <$f_in>) + { + $text_0 .= $line; + #Empty Line or Line marked by // + if(($space==0) &&(($line =~/^\s*$/)|| + (($line =~/^\s*\/\//)&&($line !~ /\*\//)))) + { + #print "\n Line $lineno is empty."; + } + elsif(($space==0) &&($line =~ /^\s*\/\*/)) #Match /* + { + $left ++; + #print "\n L Matched: $lineno $line, $left "; #Match that /* and */ in the same line + if($line =~ /\*\//) + { + $right ++; + #print "\n L Matched: $lineno $line, $left "; + } + } + elsif(($space==0) &&($line =~ /\*\//)&& ($line !~ /\/\*/) ) #Match */ + { + $right ++; + #print "\n R Matched: $lineno $line, $right "; + if($left == $right) + { + $space = 1; + } + } + elsif($left==$right) #Content Lines + { + if(($line =~/^\s*$/)&& ($count==0)) + { + + } + else + { + #print $line; + $space = 1; + $count +=1; + $text_all .=$line; + } + } + $lineno++; + } + close($f_in); + + if($text_0 ne $text_all) + { + $failno ++; + if($nofix) + { + print "\n Licence_WARN: <"; + print File::Spec->abs2rel($file_name, $top).">\n";; + } + else + { + print "\n Licence_FIXED: <"; + print File::Spec->abs2rel($file_name, $top).">\n";; + open(my $f_out, '>', $file_name) + or die "Can't Open $file_name\n"; + print $f_out $text_all; + close $f_out; + } + } + $text_all=''; +} + + +my ($c_cnt, $h_cnt) = (0, 0); +sub process +{ + my $file = $File::Find::name; + if (-f $file) + { + if(($file =~ /.*\.[CchH]$/i)) + { + $c_cnt++; + licence_process($file); + } + if(($file =~ /.*\.dts$/i)) + { + $c_cnt++; + licence_process($file); + } + if(($file =~ /.*\.dtsi$/i)) + { + $c_cnt++; + licence_process($file); + } + } +} + +for(@path) +{ + #print "\n Fine $_ \n"; + find(\&process, $_); +} diff --git a/scripts/amlogic/licence_pre.pl b/scripts/amlogic/licence_pre.pl new file mode 100755 index 000000000000..9c1da319f12b --- /dev/null +++ b/scripts/amlogic/licence_pre.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -W + + +my $FILE; +$flist = " "; +$driv = "drivers/amlogic/"; +$incs = "include/linux/amlogic/"; +$dts = "arch/arm64/boot/dts/amlogic/"; +open($FILE, '<&STDIN'); +while (<$FILE>) { + chomp; + my $line = $_; + my $new = ""; + if($line =~/^A\s+(.+\.[cChH])/) + { + $new = $1; + } + elsif(/^A\s+(.+\.dts*)/i) + { + $new = $1; + } + if( -e $new) + { + if($new =~/$driv/ || $new =~/$incs/ || $new =~/$dts/) + { + $flist = $flist.$new." "; + } + } + +} +close $FILE; + +if($flist =~/^\s*$/) +{ + #print "\n LicenceCheck exit:No *.[CcHh] added.\n\n"; + exit 0; +} +else +{ + print "\n Check :$flist\n"; +} + +$match = "Licence_WARN: <"; +$pl = "./scripts/amlogic/licence_check.pl"; +$out = 0; +$result_0 = `$pl --nofix $flist`; +if($result_0 =~/$match/) +{ + $out =1; + print $result_0; + print "\n Licence Check Error, please try to fix:\n $pl $flist\n\n" +} +else +{ + print "\n Licence Check OK\n\n" +} +exit $out; diff --git a/scripts/amlogic/mk_dtb.sh b/scripts/amlogic/mk_dtb.sh new file mode 100755 index 000000000000..0b134b2c783d --- /dev/null +++ b/scripts/amlogic/mk_dtb.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +export CROSS_COMPILE=/opt/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- + + +make ARCH=arm64 gxm_q200_2g.dtb || echo "Compile dtb Fail !!" + +make ARCH=arm64 gxm_skt.dtb || echo "Compile dtb Fail !!" + +make ARCH=arm64 gxl_p212_2g.dtb || echo "Compile dtb Fail !!" + +make ARCH=arm64 gxl_p212_1g.dtb || echo "Compile dtb Fail !!" diff --git a/scripts/amlogic/mk_gx.sh b/scripts/amlogic/mk_gx.sh new file mode 100755 index 000000000000..aa1a2cdc00ee --- /dev/null +++ b/scripts/amlogic/mk_gx.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +export CROSS_COMPILE=/opt/gcc-linaro-5.3-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- + +make ARCH=arm64 meson64_defconfig +make ARCH=arm64 -j8 Image || echo "Compile Image Fail !!" diff --git a/scripts/amlogic/pre-commit b/scripts/amlogic/pre-commit new file mode 100755 index 000000000000..cc39a442d3de --- /dev/null +++ b/scripts/amlogic/pre-commit @@ -0,0 +1,23 @@ +#!/bin/sh +# +# pre-commit hook to run check-patch on the output and stop any commits +# that do not pass. Note, only for git-commit, and not for any of the +# other scenarios +# +# Copyright 2010 Ben Dooks, + +if git rev-parse --verify HEAD 2>/dev/null >/dev/null +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +git diff --cached --stat -p $against -- | ./scripts/checkpatch.pl --no-signoff - +if [ $? -ne 0 ] +then +exit 1; +fi + +git diff --name-status --cached $against -- | ./scripts/amlogic/licence_pre.pl -