{"action":"created","issue":{"url":"https://api.github.com/repos/raspberrypi/linux/issues/1155","labels_url":"https://api.github.com/repos/raspberrypi/linux/issues/1155/labels{/name}","comments_url":"https://api.github.com/repos/raspberrypi/linux/issues/1155/comments","events_url":"https://api.github.com/repos/raspberrypi/linux/issues/1155/events","html_url":"https://github.com/raspberrypi/linux/issues/1155","id":109845954,"number":1155,"title":"arch/arm/mach-bcm2708/bcm2708.c supporting only Device Tree","user":{"login":"notro","id":530887,"avatar_url":"https://avatars.githubusercontent.com/u/530887?v=3","gravatar_id":"","url":"https://api.github.com/users/notro","html_url":"https://github.com/notro","followers_url":"https://api.github.com/users/notro/followers","following_url":"https://api.github.com/users/notro/following{/other_user}","gists_url":"https://api.github.com/users/notro/gists{/gist_id}","starred_url":"https://api.github.com/users/notro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notro/subscriptions","organizations_url":"https://api.github.com/users/notro/orgs","repos_url":"https://api.github.com/users/notro/repos","events_url":"https://api.github.com/users/notro/events{/privacy}","received_events_url":"https://api.github.com/users/notro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-10-05T17:26:42Z","updated_at":"2015-10-23T17:08:49Z","closed_at":null,"body":"I wanted to see what [arch/arm/mach-bcm2708/bcm2708.c](https://github.com/raspberrypi/linux/blob/rpi-4.2.y/arch/arm/mach-bcm2708/bcm2708.c) would look like if I removed ATAGS booting support. Mainly to see if I had missed something with regards to Device Tree.\r\nBy enabling 'bcm2835-pm-wdt', I could also remove the reboot/poweroff code (handled by the watchdog driver).\r\n\r\nThe file did shrink from 1100+ lines to 100 lines.\r\n```c\r\n/*\r\n *  linux/arch/arm/mach-bcm2708/bcm2708.c\r\n *\r\n *  Copyright (C) 2010 Broadcom\r\n *\r\n * This program is free software; you can redistribute it and/or modify\r\n * it under the terms of the GNU General Public License as published by\r\n * the Free Software Foundation; either version 2 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * This program is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n * GNU General Public License for more details.\r\n *\r\n * You should have received a copy of the GNU General Public License\r\n * along with this program; if not, write to the Free Software\r\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r\n */\r\n\r\n#include <linux/init.h>\r\n#include <linux/broadcom/vc_cma.h>\r\n#include <linux/dma-mapping.h>\r\n#include <linux/of.h>\r\n#include <linux/of_platform.h>\r\n#include <asm/mach-types.h>\r\n#include <asm/mach/arch.h>\r\n#include <asm/mach/map.h>\r\n#include <asm/system_info.h>\r\n#include <mach/system.h>\r\n\r\nstatic void __init bcm2708_init_uart1(void)\r\n{\r\n\tstruct device_node *np;\r\n\r\n\tnp = of_find_compatible_node(NULL, NULL, \"brcm,bcm2835-aux-uart\");\r\n\tif (of_device_is_available(np)) {\r\n\t\tpr_info(\"bcm2708: Mini UART enabled\\n\");\r\n\t\twritel(1, __io_address(UART1_BASE + 0x4));\r\n\t}\r\n}\r\n\r\nstatic void __init bcm2708_init(void)\r\n{\r\n\tstruct device_node *np = of_find_node_by_path(\"/system\");\r\n\tu32 val;\r\n\tu64 val64;\r\n\tint ret;\r\n\r\n#if defined(CONFIG_BCM_VC_CMA)\r\n\tvc_cma_early_init();\r\n#endif\r\n\tret = of_platform_populate(NULL, of_default_bus_match_table, NULL,\r\n\t\t\t\t   NULL);\r\n\tif (ret) {\r\n\t\tpr_err(\"of_platform_populate failed: %d\\n\", ret);\r\n\t\tBUG();\r\n\t}\r\n\r\n\tbcm2708_init_uart1();\r\n\r\n\tif (!of_property_read_u32(np, \"linux,revision\", &val))\r\n\t\tsystem_rev = val;\r\n\tif (!of_property_read_u64(np, \"linux,serial\", &val64))\r\n\t\tsystem_serial_low = val64;\r\n}\r\n\r\nstatic void __init bcm2708_init_early(void)\r\n{\r\n\t/*\r\n\t * Some devices allocate their coherent buffers from atomic\r\n\t * context. Increase size of atomic coherent pool to make sure such\r\n\t * the allocations won't fail.\r\n\t */\r\n\tinit_dma_coherent_pool_size(SZ_4M);\r\n}\r\n\r\nstatic void __init bcm2708_reserve(void)\r\n{\r\n#if defined(CONFIG_BCM_VC_CMA)\r\n\tvc_cma_reserve();\r\n#endif\r\n}\r\n\r\nstatic const char * const bcm2708_compat[] = {\r\n\t\"brcm,bcm2708\",\r\n\tNULL\r\n};\r\n\r\nMACHINE_START(BCM2708, \"BCM2708\")\r\n\t.init_machine = bcm2708_init,\r\n//\t.init_early = bcm2708_init_early,\r\n\t.reserve = bcm2708_reserve,\r\n\t.dt_compat = bcm2708_compat,\r\nMACHINE_END\r\n\r\n```\r\n\r\nI don't think this is needed anymore now that we have changed the GFP_ATOMIC allocations. At least there's no problem booting without it.\r\n```c\r\n\tinit_dma_coherent_pool_size(SZ_4M);\r\n```\r\n\r\nIf the firmware could fill in this, the kernel will report it in /proc/cpuinfo and we don't need \"linux,serial\".\r\n```\r\n/ {\r\n\tserial-number = \"00000000a1725dd1\";\r\n};\r\n```\r\n\r\nDoes anyone know of drivers/areas where we are not using mainline (excluding the clock driver, we use DT fixed clocks)?\r\n"},"comment":{"url":"https://api.github.com/repos/raspberrypi/linux/issues/comments/150635523","html_url":"https://github.com/raspberrypi/linux/issues/1155#issuecomment-150635523","issue_url":"https://api.github.com/repos/raspberrypi/linux/issues/1155","id":150635523,"user":{"login":"anholt","id":3431811,"avatar_url":"https://avatars.githubusercontent.com/u/3431811?v=3","gravatar_id":"","url":"https://api.github.com/users/anholt","html_url":"https://github.com/anholt","followers_url":"https://api.github.com/users/anholt/followers","following_url":"https://api.github.com/users/anholt/following{/other_user}","gists_url":"https://api.github.com/users/anholt/gists{/gist_id}","starred_url":"https://api.github.com/users/anholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anholt/subscriptions","organizations_url":"https://api.github.com/users/anholt/orgs","repos_url":"https://api.github.com/users/anholt/repos","events_url":"https://api.github.com/users/anholt/events{/privacy}","received_events_url":"https://api.github.com/users/anholt/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T17:08:49Z","updated_at":"2015-10-23T17:08:49Z","body":"So, I assume we could just do } else if (stat != 0) { instead, but I'm concerned that we're screwing up interrupt handling somehow and this is just the canary.\r\n\r\nOne possibly relevant thing: I assume the l1 controller is just level-triggered (if we exit bcm2836_arm_irqchip_handle_irq and stat ends up != 0 again, we get re-called)  If there's anything more complicated than that, I could imagine getting into trouble.\r\n"}}